1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

New assert() statements to validate OP_OpenEphemeral logic.

FossilOrigin-Name: 6d55c3e238e06c6727f3e816a9268b6222ebfc90ec745bbbd48430bf7b16664c
This commit is contained in:
drh
2024-10-18 01:14:14 +00:00
parent dd719bebfa
commit c2e400af04
5 changed files with 34 additions and 9 deletions

View File

@@ -4746,6 +4746,25 @@ int sqlite3BtreeCursorSize(void){
return ROUND8(sizeof(BtCursor));
}
#ifdef SQLITE_DEBUG
/*
** Return true if and only if the Btree object will be automatically
** closed with the BtCursor closes. This is used within assert() statements
** only.
*/
int sqlite3BtreeClosesWithCursor(
Btree *pBtree, /* the btree object */
BtCursor *pCur /* Corresponding cursor */
){
BtShared *pBt = pBtree->pBt;
if( (pBt->openFlags & BTREE_SINGLE)==0 ) return 0;
if( pBt->pCursor!=pCur ) return 0;
if( pCur->pNext!=0 ) return 0;
if( pCur->pBtree!=pBtree ) return 0;
return 1;
}
#endif
/*
** Initialize memory that will be converted into a BtCursor object.
**