Skip to content

Commit

Permalink
Add locking clause syntax to dialect (#310)
Browse files Browse the repository at this point in the history
Provide the correct MySQL syntax for SELECT locking clauses via the new SQLDialect properties.
  • Loading branch information
gwynne authored Aug 2, 2022
1 parent f8bd73b commit faecdf3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/MySQLKit/MySQLDialect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ public struct MySQLDialect: SQLDialect {
public var unionFeatures: SQLUnionFeatures {
[.union, .unionAll, .explicitDistinct, .parenthesizedSubqueries]
}

public var sharedSelectLockExpression: SQLExpression? {
SQLRaw("LOCK IN SHARE MODE")
}

public var exclusiveSelectLockExpression: SQLExpression? {
SQLRaw("FOR UPDATE")
}
}

0 comments on commit faecdf3

Please sign in to comment.