1
0
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:
dan
2009-10-16 14:55:03 +00:00
parent ed1f8787aa
commit fa401def25
6 changed files with 126 additions and 29 deletions

View File

@@ -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{