mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 11:26:00 +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);
|
||||
if (isReadOnly) {
|
||||
await this.query(client, 'SET SESSION TRANSACTION READ ONLY');
|
||||
}
|
||||
return {
|
||||
const dbhan = {
|
||||
client,
|
||||
database,
|
||||
};
|
||||
}
|
||||
if (isReadOnly) {
|
||||
await this.query(dbhan, 'SET SESSION TRANSACTION READ ONLY');
|
||||
}
|
||||
return dbhan;
|
||||
},
|
||||
async close(dbhan) {
|
||||
return dbhan.client.close();
|
||||
|
||||
Reference in New Issue
Block a user