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

Save the position of any open cursors before a rollback. (CVS 3026)

FossilOrigin-Name: 32d45bcf746e7e926b8cc8bd038d66e7c2ec6562
This commit is contained in:
danielk1977
2006-01-24 14:21:24 +00:00
parent f2fa8310f9
commit 2b8c13e7a7
4 changed files with 58 additions and 12 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.309 2006/01/23 13:47:47 danielk1977 Exp $
** $Id: btree.c,v 1.310 2006/01/24 14:21:24 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@@ -560,7 +560,8 @@ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
BtCursor *p;
if( sqlite3ThreadDataReadOnly()->useSharedData ){
for(p=pBt->pCursor; p; p=p->pNext){
if( p!=pExcept && p->pgnoRoot==iRoot && p->eState==CURSOR_VALID ){
if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) &&
p->eState==CURSOR_VALID ){
int rc = saveCursorPosition(p);
if( SQLITE_OK!=rc ){
return rc;
@@ -2541,6 +2542,10 @@ int sqlite3BtreeRollback(Btree *p){
BtShared *pBt = p->pBt;
MemPage *pPage1;
rc = saveAllCursors(pBt, 0, 0);
if( rc!=SQLITE_OK ){
return rc;
}
btreeIntegrity(p);
unlockAllTables(p);