mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Fix the OP_NullRow opcode so that it works even if it applied to an
ephemeral cursor that has not yet been created. FossilOrigin-Name: 0e925654c24774933c7738c68f704b229c68e18c8baa45f506b8d6f09164d0d8
This commit is contained in:
@@ -4192,8 +4192,8 @@ case OP_OpenDup: {
|
||||
pCx->pgnoRoot = pOrig->pgnoRoot;
|
||||
pCx->isOrdered = pOrig->isOrdered;
|
||||
pCx->ub.pBtx = pOrig->ub.pBtx;
|
||||
pCx->hasBeenDuped = 1;
|
||||
pOrig->hasBeenDuped = 1;
|
||||
pCx->noReuse = 1;
|
||||
pOrig->noReuse = 1;
|
||||
rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
|
||||
pCx->pKeyInfo, pCx->uc.pCursor);
|
||||
/* The sqlite3BtreeCursor() routine can only fail for the first cursor
|
||||
@@ -4260,7 +4260,7 @@ case OP_OpenEphemeral: {
|
||||
aMem[pOp->p3].z = "";
|
||||
}
|
||||
pCx = p->apCsr[pOp->p1];
|
||||
if( pCx && !pCx->hasBeenDuped && ALWAYS(pOp->p2<=pCx->nField) ){
|
||||
if( pCx && !pCx->noReuse && ALWAYS(pOp->p2<=pCx->nField) ){
|
||||
/* If the ephermeral table is already open and has no duplicates from
|
||||
** OP_OpenDup, then erase all existing content so that the table is
|
||||
** empty again, rather than creating a new table. */
|
||||
@@ -5847,6 +5847,7 @@ case OP_NullRow: {
|
||||
if( pC==0 ) goto no_mem;
|
||||
pC->seekResult = 0;
|
||||
pC->isTable = 1;
|
||||
pC->noReuse = 1;
|
||||
pC->uc.pCursor = sqlite3BtreeFakeValidCursor();
|
||||
}
|
||||
pC->nullRow = 1;
|
||||
|
Reference in New Issue
Block a user