mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix(MySQL): not every connection gets read-only option
This commit is contained in:
@ -225,6 +225,9 @@ export class MySQLClient extends AntaresCore {
|
|||||||
if (hasAnsiQuotes)
|
if (hasAnsiQuotes)
|
||||||
await connection.query(`SET SESSION sql_mode = '${sqlMode.filter((m: string) => !['ANSI', 'ANSI_QUOTES'].includes(m)).join(',')}'`);
|
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 => {
|
connection.on('connection', conn => {
|
||||||
if (this._params.readonly)
|
if (this._params.readonly)
|
||||||
conn.query('SET SESSION TRANSACTION READ ONLY');
|
conn.query('SET SESSION TRANSACTION READ ONLY');
|
||||||
|
Reference in New Issue
Block a user