mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-31 18:11:01 +03:00
Automatically close ephemeral b-trees when their last cursor is closed.
FossilOrigin-Name: 39b5af18c0580c8e92516d410f8c465bfec31b2d0be9df1cfd6a1d1a19b4fc14
This commit is contained in:
@@ -2472,20 +2472,15 @@ void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
|
||||
return;
|
||||
}
|
||||
assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE );
|
||||
assert( pCx->pBtx==0 || pCx->isEphemeral );
|
||||
switch( pCx->eCurType ){
|
||||
case CURTYPE_SORTER: {
|
||||
sqlite3VdbeSorterClose(p->db, pCx);
|
||||
break;
|
||||
}
|
||||
case CURTYPE_BTREE: {
|
||||
if( pCx->isEphemeral ){
|
||||
if( pCx->pBtx ) sqlite3BtreeClose(pCx->pBtx);
|
||||
/* The pCx->pCursor will be close automatically, if it exists, by
|
||||
** the call above. */
|
||||
}else{
|
||||
assert( pCx->uc.pCursor!=0 );
|
||||
sqlite3BtreeCloseCursor(pCx->uc.pCursor);
|
||||
}
|
||||
assert( pCx->uc.pCursor!=0 );
|
||||
sqlite3BtreeCloseCursor(pCx->uc.pCursor);
|
||||
break;
|
||||
}
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
||||
Reference in New Issue
Block a user