1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix BEGIN IMMEDIATE and BEGIN EXCLUSIVE so that they work even if one or

more of the database files in the connection are read-only.  Test cases
for this are in TH3.

FossilOrigin-Name: 2fa08c3963f008d4723c3f4f4496abcb6d4b575c85ba4a911a6aed5730b5948b
This commit is contained in:
drh
2020-10-12 13:24:00 +00:00
parent 0897c3c056
commit 1ca037f41e
4 changed files with 21 additions and 10 deletions

View File

@@ -3487,7 +3487,8 @@ case OP_AutoCommit: {
** active.
** If P2 is non-zero, then a write-transaction is started, or if a
** read-transaction is already active, it is upgraded to a write-transaction.
** If P2 is zero, then a read-transaction is started.
** If P2 is zero, then a read-transaction is started. If P2 is 2 or more
** then an exclusive transaction is started.
**
** P1 is the index of the database file on which the transaction is
** started. Index 0 is the main database file and index 1 is the
@@ -3521,6 +3522,7 @@ case OP_Transaction: {
assert( p->bIsReader );
assert( p->readOnly==0 || pOp->p2==0 );
assert( pOp->p2>=0 && pOp->p2<=2 );
assert( pOp->p1>=0 && pOp->p1<db->nDb );
assert( DbMaskTest(p->btreeMask, pOp->p1) );
if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){