mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 17:53:59 +00:00
fixed readonly connection for MySQL
This commit is contained in:
@@ -49,13 +49,14 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const client = mysql2.createConnection(options);
|
const client = mysql2.createConnection(options);
|
||||||
if (isReadOnly) {
|
const dbhan = {
|
||||||
await this.query(client, 'SET SESSION TRANSACTION READ ONLY');
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
client,
|
client,
|
||||||
database,
|
database,
|
||||||
};
|
}
|
||||||
|
if (isReadOnly) {
|
||||||
|
await this.query(dbhan, 'SET SESSION TRANSACTION READ ONLY');
|
||||||
|
}
|
||||||
|
return dbhan;
|
||||||
},
|
},
|
||||||
async close(dbhan) {
|
async close(dbhan) {
|
||||||
return dbhan.client.close();
|
return dbhan.client.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user