aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree.c12
-rw-r--r--src/btree.h3
-rw-r--r--src/vdbe.c5
3 files changed, 12 insertions, 8 deletions
diff --git a/src/btree.c b/src/btree.c
index eae118ef8..538a706d6 100644
--- a/src/btree.c
+++ b/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))
diff --git a/src/btree.h b/src/btree.h
index 5db917b5d..3f8c4ea4b 100644
--- a/src/btree.h
+++ b/src/btree.h
@@ -13,7 +13,7 @@
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
-** @(#) $Id: btree.h,v 1.103 2008/08/13 19:11:48 drh Exp $
+** @(#) $Id: btree.h,v 1.104 2008/10/08 17:58:49 danielk1977 Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
@@ -170,6 +170,7 @@ struct Pager *sqlite3BtreePager(Btree*);
int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
void sqlite3BtreeCacheOverflow(BtCursor *);
+void sqlite3BtreeClearCursor(BtCursor *);
#ifdef SQLITE_TEST
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
diff --git a/src/vdbe.c b/src/vdbe.c
index 6b9faf7e5..6ee22c1b6 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.781 2008/10/07 23:46:38 drh Exp $
+** $Id: vdbe.c,v 1.782 2008/10/08 17:58:49 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -3692,6 +3692,9 @@ case OP_NullRow: {
assert( pC!=0 );
pC->nullRow = 1;
pC->rowidIsValid = 0;
+ if( pC->pCursor ){
+ sqlite3BtreeClearCursor(pC->pCursor);
+ }
break;
}