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

Workaround the need for internal API sqlite3BtreeCursorDb(). It was only being used for an assert() statement, which can be done differently. (CVS 6683)

FossilOrigin-Name: 5904af6e6df3effdaaa30e7cf96ee316fc09b28d
This commit is contained in:
danielk1977
2009-05-28 11:05:57 +00:00
parent 33e619fc1c
commit 4b0aa4cf3e
5 changed files with 20 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
C Additional\srefinements\sto\sExpr\shandling.\s\sRestore\scompression\sof\strigger\nexpressions.\s\sChange\sExpr.zToken\sto\sExpr.u.zToken\sand\sadded\sExpr.u.iValue.\nRemove\san\sunnecessary\sExprDup\sfrom\sCHECK\sconstraint\sprocessing.\s\sAnd\sso\sforth.\s(CVS\s6682) C Workaround\sthe\sneed\sfor\sinternal\sAPI\ssqlite3BtreeCursorDb().\sIt\swas\sonly\sbeing\sused\sfor\san\sassert()\sstatement,\swhich\scan\sbe\sdone\sdifferently.\s(CVS\s6683)
D 2009-05-28T01:00:55 D 2009-05-28T11:05:57
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,8 +106,8 @@ F src/auth.c 98db07c2088455797678eb1031f42d4d94d18a71
F src/backup.c 437efc2c3371b52bbb943b8c9dfabba774adcf86 F src/backup.c 437efc2c3371b52bbb943b8c9dfabba774adcf86
F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d F src/bitvec.c ef370407e03440b0852d05024fb016b14a471d3d
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c 7c4b02afea7efb561361f20408414fec68df898c F src/btree.c 41bee6e4699e61f9d33beabfcf13caba4467c20a
F src/btree.h 58d876d3ed944a8f4f1fd0e67024b385243fc9dd F src/btree.h 3748683b382bc3022f23840c0a35d3231b24fc6e
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5 F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c 567574f5756e9e462cf50c5da1895dc43672bafe F src/build.c 567574f5756e9e462cf50c5da1895dc43672bafe
F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686 F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686
@@ -209,7 +209,7 @@ F src/vdbeInt.h 43183a2a18654fa570219ab65e53a608057c48ae
F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed F src/vdbeapi.c 86aa27a5f3493aaffb8ac051782aa3b22670d7ed
F src/vdbeaux.c 1a07329bdf51cc3687f88d9f5b2bd3f1d47cc5a8 F src/vdbeaux.c 1a07329bdf51cc3687f88d9f5b2bd3f1d47cc5a8
F src/vdbeblob.c 5c5abe9af28316772e7829359f6f9cda2c737ebd F src/vdbeblob.c 5c5abe9af28316772e7829359f6f9cda2c737ebd
F src/vdbemem.c 9f4224911176f27b80d6e8f70f0e909aead5091b F src/vdbemem.c 05183d46094aa99b8f8350e5761b9369dbef35a8
F src/vtab.c b0216337ae7d27708dedd56d220e6f4fecda92f1 F src/vtab.c b0216337ae7d27708dedd56d220e6f4fecda92f1
F src/walker.c ec4b9742a4077ef80346e2f9aaf0f44c2d95087a F src/walker.c ec4b9742a4077ef80346e2f9aaf0f44c2d95087a
F src/where.c 1a21128db4905a29c287086acd7962cbba1c6f7b F src/where.c 1a21128db4905a29c287086acd7962cbba1c6f7b
@@ -731,7 +731,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 7cb1c3ba0759539cb035978fdaff6316775986f3 P 4ac2bdfbb4230b6ceaae87e738fa61036bbe03cb
R fbcf886b0709cb6861bc0baa12580b58 R 1d2cfe85976ea7e6f0cff5f4581d1028
U drh U danielk1977
Z 0ccb491a6522821e67071949c3a88c54 Z 958dcf1176b8cee3abaf43be3cebcb59

View File

@@ -1 +1 @@
4ac2bdfbb4230b6ceaae87e738fa61036bbe03cb 5904af6e6df3effdaaa30e7cf96ee316fc09b28d

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** 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. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** 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. ** in the common case where no overflow pages are used.
*/ */
const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){ const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
if( pCur->eState==CURSOR_VALID ){ if( pCur->eState==CURSOR_VALID ){
return (const void*)fetchPayload(pCur, pAmt, 0); return (const void*)fetchPayload(pCur, pAmt, 0);
@@ -3699,6 +3700,7 @@ const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){
return 0; return 0;
} }
const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){ const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
if( pCur->eState==CURSOR_VALID ){ if( pCur->eState==CURSOR_VALID ){
return (const void*)fetchPayload(pCur, pAmt, 1); return (const void*)fetchPayload(pCur, pAmt, 1);
@@ -4193,14 +4195,6 @@ int sqlite3BtreeEof(BtCursor *pCur){
return (CURSOR_VALID!=pCur->eState); return (CURSOR_VALID!=pCur->eState);
} }
/*
** 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 ** Advance the cursor to the next entry in the database. If
** successful then set *pRes=0. If the cursor ** successful then set *pRes=0. If the cursor

View File

@@ -13,7 +13,7 @@
** subsystem. See comments in the source code for a detailed description ** subsystem. See comments in the source code for a detailed description
** of what each interface routine does. ** 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_ #ifndef _BTREE_H_
#define _BTREE_H_ #define _BTREE_H_
@@ -157,7 +157,6 @@ int sqlite3BtreeFlags(BtCursor*);
int sqlite3BtreePrevious(BtCursor*, int *pRes); int sqlite3BtreePrevious(BtCursor*, int *pRes);
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
sqlite3 *sqlite3BtreeCursorDb(const BtCursor*);
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt); const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt); const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);

View File

@@ -15,7 +15,7 @@
** only within the VDBE. Interface routines refer to a Mem using the ** only within the VDBE. Interface routines refer to a Mem using the
** name sqlite_value ** 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 "sqliteInt.h"
#include "vdbeInt.h" #include "vdbeInt.h"
@@ -848,13 +848,12 @@ int sqlite3VdbeMemFromBtree(
int key, /* If true, retrieve from the btree key, not data. */ int key, /* If true, retrieve from the btree key, not data. */
Mem *pMem /* OUT: Return data in this Mem structure. */ Mem *pMem /* OUT: Return data in this Mem structure. */
){ ){
char *zData; /* Data from the btree layer */ char *zData; /* Data from the btree layer */
int available = 0; /* Number of bytes available on the local btree page */ int available = 0; /* Number of bytes available on the local btree page */
sqlite3 *db; /* Database connection */ int rc = SQLITE_OK; /* Return code */
int rc = SQLITE_OK;
db = sqlite3BtreeCursorDb(pCur); /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert()
assert( sqlite3_mutex_held(db->mutex) ); ** that both the BtShared and database handle mutexes are held. */
assert( (pMem->flags & MEM_RowSet)==0 ); assert( (pMem->flags & MEM_RowSet)==0 );
if( key ){ if( key ){
zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);