forUpdate

abstract fun forUpdate(of: String? = null, mode: LockWaitMode? = null): SelectQueryBuilder

Appends a FOR UPDATE locking clause to the query.

Locks selected rows for the duration of the current transaction, preventing concurrent modification.

Parameters

of

Optional comma-separated list of table names to lock (e.g., "users, accounts"). If null, all tables referenced in the query are locked.

mode

Optional wait strategy: LockWaitMode.NOWAIT raises an error immediately if any row is locked; LockWaitMode.SKIP_LOCKED silently skips locked rows. If null, the query waits until the lock is acquired.