diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 30 | ||||
-rw-r--r-- | src/build.c | 3 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/btree.c b/src/btree.c index 9f0a2e7f5..9b206a3b9 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.285 2006/01/07 13:21:04 danielk1977 Exp $ +** $Id: btree.c,v 1.286 2006/01/09 05:36:27 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -348,9 +348,11 @@ struct BtShared { BtShared *pNext; /* Next in SqliteTsd.pBtree linked list */ int nRef; /* Number of references to this structure */ int nTransaction; /* Number of open transactions (read + write) */ + void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */ + void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */ +#ifndef SQLITE_OMIT_SHARED_CACHE BtLock *pLock; /* List of locks held on this shared-btree struct */ - void *pSchema; - void (*xFreeSchema)(void*); +#endif }; /* @@ -3157,9 +3159,10 @@ static int moveToRoot(BtCursor *pCur){ int rc; BtShared *pBt = pCur->pBtree->pBt; - restoreCursorPosition(pCur, 0); - rc = getAndInitPage(pBt, pCur->pgnoRoot, &pRoot, 0); - if( rc ){ + if( + SQLITE_OK!=(rc = restoreCursorPosition(pCur, 0)) || + SQLITE_OK!=(rc = getAndInitPage(pBt, pCur->pgnoRoot, &pRoot, 0)) + ){ pCur->eState = CURSOR_INVALID; return rc; } @@ -5141,14 +5144,14 @@ int sqlite3BtreeInsert( } /* Save the positions of any other cursors open on this table */ - restoreCursorPosition(pCur, 0); - rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); - if( rc ){ + if( + SQLITE_OK!=(rc = restoreCursorPosition(pCur, 0)) || + SQLITE_OK!=(rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) || + SQLITE_OK!=(rc = sqlite3BtreeMoveto(pCur, pKey, nKey, &loc)) + ){ return rc; } - rc = sqlite3BtreeMoveto(pCur, pKey, nKey, &loc); - if( rc ) return rc; pPage = pCur->pPage; assert( pPage->intKey || nKey>=0 ); assert( pPage->leaf || !pPage->leafData ); @@ -6479,11 +6482,14 @@ int sqlite3BtreeSchemaLocked(Btree *p){ } int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ + int rc = SQLITE_OK; +#ifndef SQLITE_OMIT_SHARED_CACHE u8 lockType = (isWriteLock?WRITE_LOCK:READ_LOCK); - int rc = queryTableLock(p, iTab, lockType); + rc = queryTableLock(p, iTab, lockType); if( rc==SQLITE_OK ){ rc = lockTable(p, iTab, lockType); } +#endif return rc; } diff --git a/src/build.c b/src/build.c index 494972b4b..907746584 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.369 2006/01/07 13:21:04 danielk1977 Exp $ +** $Id: build.c,v 1.370 2006/01/09 05:36:27 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -154,7 +154,6 @@ void sqlite3FinishCoding(Parse *pParse){ ** transaction on each used database and to verify the schema cookie ** on each used database. */ - assert( pParse->cookieGoto>0 || pParse->nTableLock==0 ); if( pParse->cookieGoto>0 ){ u32 mask; int iDb; |