pub async fn begin_immediate(
pool: &SqlitePool,
) -> Result<Transaction<'static, Sqlite>>Expand description
Begin a WRITE transaction with BEGIN IMMEDIATE.
sqlx’s pool.begin() issues a deferred BEGIN: a transaction that reads
before it writes pins its read snapshot on the first statement, and if
another connection commits in between, the later write cannot upgrade —
SQLite returns a busy-snapshot error even with a busy_timeout, because the
conflict is logical, not a lock wait. BEGIN IMMEDIATE takes the write lock
up front, so a read-then-write transaction is safe under WAL’s single-writer
rule.