fixed readonly connection for MySQL

This commit is contained in:
Jan Prochazka
2024-09-25 10:49:37 +02:00
parent 58e65608e4
commit e3249c6d79

View File

@@ -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();