Skip to content

Commit

Permalink
refactor: separate isolation level and access mode with a comma in MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Feb 9, 2025
1 parent 7694816 commit f224196
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dialect/mysql/mysql-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ export class MysqlDriver implements Driver {
settings: TransactionSettings,
): Promise<void> {
if (settings.isolationLevel || settings.accessMode) {
let sql = 'set transaction'
const parts: string[] = []

if (settings.isolationLevel) {
sql += ` isolation level ${settings.isolationLevel}`
parts.push(`isolation level ${settings.isolationLevel}`)
}

if (settings.accessMode) {
sql += ` ${settings.accessMode}`
parts.push(settings.accessMode)
}

const sql = `set transaction ${parts.join(', ')}`

// On MySQL this sets the isolation level of the next transaction.
await connection.executeQuery(CompiledQuery.raw(sql))
}
Expand Down

0 comments on commit f224196

Please sign in to comment.