1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Ensure that when an ephemeral cursor is reopened with a second invocation of to OP_OpenEphemeral, the sequence counter is reset and the cache marked as stale. Fix for [9cdc5c46].

FossilOrigin-Name: 5fd20e09a522b62a529cf4d76fbdf0a09426f67ffa30430cac6b81ebf32ba43e
This commit is contained in:
dan
2019-06-26 21:04:30 +00:00
parent 07312a6b06
commit 855b5d144a
4 changed files with 28 additions and 9 deletions

View File

@@ -3753,13 +3753,14 @@ case OP_OpenEphemeral: {
/* If the ephermeral table is already open, erase all existing content
** so that the table is empty again, rather than creating a new table. */
assert( pCx->isEphemeral );
pCx->seqCount = 0;
pCx->cacheStatus = CACHE_STALE;
if( pCx->pBtx ){
rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
}
}else{
pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
if( pCx==0 ) goto no_mem;
pCx->nullRow = 1;
pCx->isEphemeral = 1;
rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx,
BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
@@ -3795,6 +3796,7 @@ case OP_OpenEphemeral: {
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
}
if( rc ) goto abort_due_to_error;
pCx->nullRow = 1;
break;
}