Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 31c319c

Browse files
committed
Improve "BEGIN IMMEDIATE" docs
1 parent 124805e commit 31c319c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

wp-includes/sqlite-ast/class-wp-sqlite-driver.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,28 @@ public function begin_transaction(): void {
745745
*
746746
* From the SQLite documentation:
747747
*
748+
* ## Read transactions versus write transactions
749+
*
748750
* If a write statement occurs while a read transaction is active,
749751
* then the read transaction is upgraded to a write transaction if
750752
* possible. If some other database connection has already modified
751753
* the database or is already in the process of modifying the database,
752754
* then upgrading to a write transaction is not possible and the write
753755
* statement will fail with SQLITE_BUSY.
754756
*
757+
* ## DEFERRED, IMMEDIATE, and EXCLUSIVE transactions
758+
*
759+
* Transactions can be DEFERRED, IMMEDIATE, or EXCLUSIVE. The default
760+
* transaction behavior is DEFERRED.
761+
*
762+
* DEFERRED means that the transaction does not actually start until
763+
* the database is first accessed.
764+
*
765+
* IMMEDIATE causes the database connection to start a new write
766+
* immediately, without waiting for a write statement. The BEGIN
767+
* IMMEDIATE might fail with SQLITE_BUSY if another write transaction
768+
* is already active on another database connection.
769+
*
755770
* See:
756771
* - https://www.sqlite.org/lang_transaction.html
757772
* - https://www.sqlite.org/rescode.html#busy

0 commit comments

Comments
 (0)