From faecdf353d00732572f38a776ff02a24520df893 Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Tue, 2 Aug 2022 16:35:36 -0500 Subject: [PATCH] Add locking clause syntax to dialect (#310) Provide the correct MySQL syntax for SELECT locking clauses via the new SQLDialect properties. --- Sources/MySQLKit/MySQLDialect.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/MySQLKit/MySQLDialect.swift b/Sources/MySQLKit/MySQLDialect.swift index 0a214f8..0753fe3 100644 --- a/Sources/MySQLKit/MySQLDialect.swift +++ b/Sources/MySQLKit/MySQLDialect.swift @@ -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") + } }