Skip to content

Commit 0497525

Browse files
B4nanigalklebanov
authored andcommitted
refactor: separate isolation level and access mode with a comma in MySQL (#1350)
1 parent f32c231 commit 0497525

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/dialect/mysql/mysql-driver.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,18 @@ export class MysqlDriver implements Driver {
7474
settings: TransactionSettings,
7575
): Promise<void> {
7676
if (settings.isolationLevel || settings.accessMode) {
77-
let sql = 'set transaction'
77+
const parts: string[] = []
7878

7979
if (settings.isolationLevel) {
80-
sql += ` isolation level ${settings.isolationLevel}`
80+
parts.push(`isolation level ${settings.isolationLevel}`)
8181
}
8282

8383
if (settings.accessMode) {
84-
sql += ` ${settings.accessMode}`
84+
parts.push(settings.accessMode)
8585
}
8686

87+
const sql = `set transaction ${parts.join(', ')}`
88+
8789
// On MySQL this sets the isolation level of the next transaction.
8890
await connection.executeQuery(CompiledQuery.raw(sql))
8991
}

0 commit comments

Comments
 (0)