aboutsummaryrefslogtreecommitdiff
path: root/src/btree.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2009-10-16 14:55:03 +0000
committerdan <dan@noemail.net>2009-10-16 14:55:03 +0000
commitfa401def25caa6066f171d09c165b9d654f59d12 (patch)
tree52d6fd5872e3413780a03027741fdc68097cbf92 /src/btree.c
parented1f8787aa85ff21ade0d82e2df50bb5884ea8a2 (diff)
downloadsqlite-fa401def25caa6066f171d09c165b9d654f59d12.tar.gz
sqlite-fa401def25caa6066f171d09c165b9d654f59d12.zip
Experimental fix for [f777251dc7]. This may be changed yet.
FossilOrigin-Name: 174477bca05d019e663fd2b7cd031189ab2e010a
Diffstat (limited to 'src/btree.c')
-rw-r--r--src/btree.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/btree.c b/src/btree.c
index a9ab44504..218c96835 100644
--- a/src/btree.c
+++ b/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{