Skip to content

Instance Method

for(_:)

Adds a locking clause to this query. If called more than once, the last call wins.
@discardableResult func `for`(_ lockingClause: SQLLockingClause) -> Self

Discussion

db.select()...for(.update)
db.select()...for(.share)

Also referred to as locking or “consistent” reads, the locking clause syntax locks all selected rows for the duration of the current transaction with a type of lock determined by the specific locking clause and the underlying database’s support for this construct.

Warning

If the database in use does not support locking reads, the locking clause will be silently ignored regardless of its value.