Skip to content

Commit

Permalink
fix(MySQL): not every connection gets read-only option
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Dec 23, 2022
1 parent 2982b6c commit 843c15e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ export class MySQLClient extends AntaresCore {
if (hasAnsiQuotes)
await connection.query(`SET SESSION sql_mode = '${sqlMode.filter((m: string) => !['ANSI', 'ANSI_QUOTES'].includes(m)).join(',')}'`);

if (this._params.readonly)
await connection.query('SET SESSION TRANSACTION READ ONLY');

connection.on('connection', conn => {
if (this._params.readonly)
conn.query('SET SESSION TRANSACTION READ ONLY');
Expand Down

0 comments on commit 843c15e

Please sign in to comment.