diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 12 | ||||
-rw-r--r-- | src/btree.h | 3 | ||||
-rw-r--r-- | src/vdbemem.c | 13 |
3 files changed, 10 insertions, 18 deletions
diff --git a/src/btree.c b/src/btree.c index 338d99ecc..74c4f6163 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.608 2009/05/06 18:57:10 shane Exp $ +** $Id: btree.c,v 1.609 2009/05/28 11:05:57 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -3692,6 +3692,7 @@ static const unsigned char *fetchPayload( ** in the common case where no overflow pages are used. */ const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){ + assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( cursorHoldsMutex(pCur) ); if( pCur->eState==CURSOR_VALID ){ return (const void*)fetchPayload(pCur, pAmt, 0); @@ -3699,6 +3700,7 @@ const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){ return 0; } const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){ + assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( cursorHoldsMutex(pCur) ); if( pCur->eState==CURSOR_VALID ){ return (const void*)fetchPayload(pCur, pAmt, 1); @@ -4194,14 +4196,6 @@ int sqlite3BtreeEof(BtCursor *pCur){ } /* -** Return the database connection handle for a cursor. -*/ -sqlite3 *sqlite3BtreeCursorDb(const BtCursor *pCur){ - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - return pCur->pBtree->db; -} - -/* ** Advance the cursor to the next entry in the database. If ** successful then set *pRes=0. If the cursor ** was already pointing to the last entry in the database before diff --git a/src/btree.h b/src/btree.h index b4b7e0d19..bb9cfad6d 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.114 2009/05/04 11:42:30 danielk1977 Exp $ +** @(#) $Id: btree.h,v 1.115 2009/05/28 11:05:57 danielk1977 Exp $ */ #ifndef _BTREE_H_ #define _BTREE_H_ @@ -157,7 +157,6 @@ int sqlite3BtreeFlags(BtCursor*); int sqlite3BtreePrevious(BtCursor*, int *pRes); int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); -sqlite3 *sqlite3BtreeCursorDb(const BtCursor*); const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt); const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt); int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); diff --git a/src/vdbemem.c b/src/vdbemem.c index f5120c86b..6d53c74ae 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -15,7 +15,7 @@ ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value ** -** $Id: vdbemem.c,v 1.146 2009/05/28 01:00:55 drh Exp $ +** $Id: vdbemem.c,v 1.147 2009/05/28 11:05:57 danielk1977 Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -848,13 +848,12 @@ int sqlite3VdbeMemFromBtree( int key, /* If true, retrieve from the btree key, not data. */ Mem *pMem /* OUT: Return data in this Mem structure. */ ){ - char *zData; /* Data from the btree layer */ - int available = 0; /* Number of bytes available on the local btree page */ - sqlite3 *db; /* Database connection */ - int rc = SQLITE_OK; + char *zData; /* Data from the btree layer */ + int available = 0; /* Number of bytes available on the local btree page */ + int rc = SQLITE_OK; /* Return code */ - db = sqlite3BtreeCursorDb(pCur); - assert( sqlite3_mutex_held(db->mutex) ); + /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() + ** that both the BtShared and database handle mutexes are held. */ assert( (pMem->flags & MEM_RowSet)==0 ); if( key ){ zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); |