deferred
Transaction Mode: Deferred
Applies DEFERRED
mode to this transaction; another transaction object is returned (a copy), applying this mode, but with the same properties otherwise.
SQLite documentation describes DEFERRED
-mode transactions as:
"DEFERRED
means that the transaction does not actually start until the database is first accessed. Internally, the BEGIN DEFERRED
statement merely sets a flag on the database connection that turns off the automatic commit that would normally occur when the last statement finishes. This causes the transaction that is automatically started to persist until an explicit COMMIT
or ROLLBACK
or until a rollback is provoked by an error or an ON CONFLICT ROLLBACK
clause. If the first statement after BEGIN DEFERRED
is a SELECT
, then a read transaction is started. Subsequent write statements will upgrade the transaction to a write transaction if possible, or return SQLITE_BUSY
. If the first statement after BEGIN DEFERRED
is a write statement, then a write transaction is started."