forUpdate

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

Locks the selected rows with FOR UPDATE, for a read-then-write that must not race.

Only meaningful inside a transaction - the lock is held until it ends, and outside one that is until the statement finishes, which is no lock at all.

Parameters

of

Which tables of the query to lock, where it names more than one. null locks all of them.

mode

What to do about rows already locked. null waits for them.