FirebirdSQL logo

Locking

Firebird implements optimistic row-level locking under all conditions.A transaction does not attempt to lock a record until it is ready to post an update operation affecting that record.It can happen, though rarely, for an update to fail because another client has a lock on the record, even if the transaction that fails started before the one which secured the lock.

Firebird’s record versioning engine is able to achieve a granularity finer than that provided by traditional row-level locking.Versioning allows any number of transactions to read a consistent copy of any given record, even if other transactions are updating the same row simultaneously.Readers and writers never block one another and Firebird’s maintenance of record versions is totally transparent to the user.

Transaction Request Syntax

The syntax for an ODBC-friendly transaction request follows.

SET | DECLARE TRANSACTION [LOCAL] [NAME transaction-name [USING namedUniqueWorkspace]]
[READ WRITE | READ ONLY]
[WAIT | NO WAIT]
[AUTOCOMMIT]
[NO_AUTO_UNDO]
| REPEATABLE READ
| SERIALIZABLE
| READ COMMITTED [[NO] RECORD_VERSION]}]
[RESERVING table-name-1 [, table-name-2[, ...table-name-n] ]
[FOR [SHARED | PROTECTED] {READ | WRITE}] [, ]