mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
After an OP_NullRow is executed on a cursor, cause any subsequent OP_Next or OP_Prev to behave as if there were no more rows to traverse. Ticket #3424. (CVS 5782)
FossilOrigin-Name: af679f6170b346fe61df7dae963b2a2853e62a62
This commit is contained in:
12
src/btree.c
12
src/btree.c
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.524 2008/09/30 17:18:17 drh Exp $
|
||||
** $Id: btree.c,v 1.525 2008/10/08 17:58:49 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
@@ -368,7 +368,7 @@ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
|
||||
/*
|
||||
** Clear the current cursor position.
|
||||
*/
|
||||
static void clearCursorPosition(BtCursor *pCur){
|
||||
void sqlite3BtreeClearCursor(BtCursor *pCur){
|
||||
assert( cursorHoldsMutex(pCur) );
|
||||
sqlite3_free(pCur->pKey);
|
||||
pCur->pKey = 0;
|
||||
@@ -2594,7 +2594,7 @@ void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
|
||||
BtCursor *p;
|
||||
sqlite3BtreeEnter(pBtree);
|
||||
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
|
||||
clearCursorPosition(p);
|
||||
sqlite3BtreeClearCursor(p);
|
||||
p->eState = CURSOR_FAULT;
|
||||
p->skip = errCode;
|
||||
}
|
||||
@@ -2867,7 +2867,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){
|
||||
BtShared *pBt = pCur->pBt;
|
||||
sqlite3BtreeEnter(pBtree);
|
||||
pBt->db = pBtree->db;
|
||||
clearCursorPosition(pCur);
|
||||
sqlite3BtreeClearCursor(pCur);
|
||||
if( pCur->pPrev ){
|
||||
pCur->pPrev->pNext = pCur->pNext;
|
||||
}else{
|
||||
@@ -3526,7 +3526,7 @@ static int moveToRoot(BtCursor *pCur){
|
||||
if( pCur->eState==CURSOR_FAULT ){
|
||||
return pCur->skip;
|
||||
}
|
||||
clearCursorPosition(pCur);
|
||||
sqlite3BtreeClearCursor(pCur);
|
||||
}
|
||||
|
||||
if( pCur->iPage>=0 ){
|
||||
@@ -5771,7 +5771,7 @@ int sqlite3BtreeInsert(
|
||||
}
|
||||
|
||||
/* Save the positions of any other cursors open on this table */
|
||||
clearCursorPosition(pCur);
|
||||
sqlite3BtreeClearCursor(pCur);
|
||||
if(
|
||||
SQLITE_OK!=(rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) ||
|
||||
SQLITE_OK!=(rc = sqlite3BtreeMoveto(pCur, pKey, nKey, appendBias, &loc))
|
||||
|
Reference in New Issue
Block a user