mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Experimental fix for [f777251dc7]. This may be changed yet.
FossilOrigin-Name: 174477bca05d019e663fd2b7cd031189ab2e010a
This commit is contained in:
13
src/btree.c
13
src/btree.c
@@ -2965,18 +2965,13 @@ int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){
|
||||
*/
|
||||
static void btreeEndTransaction(Btree *p){
|
||||
BtShared *pBt = p->pBt;
|
||||
BtCursor *pCsr;
|
||||
assert( sqlite3BtreeHoldsMutex(p) );
|
||||
|
||||
/* Search for a cursor held open by this b-tree connection. If one exists,
|
||||
** then the transaction will be downgraded to a read-only transaction
|
||||
** instead of actually concluded. A subsequent call to CommitPhaseTwo()
|
||||
** or Rollback() will finish the transaction and unlock the database. */
|
||||
for(pCsr=pBt->pCursor; pCsr && pCsr->pBtree!=p; pCsr=pCsr->pNext);
|
||||
assert( pCsr==0 || p->inTrans>TRANS_NONE );
|
||||
|
||||
btreeClearHasContent(pBt);
|
||||
if( pCsr ){
|
||||
if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
|
||||
/* If there are other active statements that belong to this database
|
||||
** handle, downgrade to a read-only transaction. The other statements
|
||||
** may still be reading from the database. */
|
||||
downgradeAllSharedCacheTableLocks(p);
|
||||
p->inTrans = TRANS_READ;
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user