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

Simplifications to btree.c in support of coverage testing. (CVS 6923)

FossilOrigin-Name: 375fd6f9c54fa5aa8cfae30845c7bfc0ec49e8fa
This commit is contained in:
drh
2009-07-22 18:07:40 +00:00
parent e878a2f41b
commit 5d1a872ab6
4 changed files with 21 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
C Avoid\sleaving\sa\ssuspect\spage\sin\sthe\spage-cache\sif\san\serror\soccurs\sduring\ssqlite3PagerAcquire().\s(CVS\s6922) C Simplifications\sto\sbtree.c\sin\ssupport\sof\scoverage\stesting.\s(CVS\s6923)
D 2009-07-22T16:41:15 D 2009-07-22T18:07:41
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c cfbf6af5b0ababb4f06ed3e75c616dadaf47fcbd F src/bitvec.c cfbf6af5b0ababb4f06ed3e75c616dadaf47fcbd
F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7 F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7
F src/btree.c 74655dc71c61130c7328e3cdee3c86b86ce8ce0f F src/btree.c e3cd5ed99cdf946d9e95dd88dd09647746e472f5
F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe
F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705 F src/btreeInt.h 1c86297e69380f6577e7ae67452597dd8d5c2705
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -210,7 +210,7 @@ F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007
F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624 F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624
F src/vdbeaux.c a1ed07f91a9d59d39e97b2844554a07c91c9b809 F src/vdbeaux.c a1ed07f91a9d59d39e97b2844554a07c91c9b809
F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611 F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611
F src/vdbemem.c 50cc051619ba457d762e0f17dfe1d6c926c5c4d5 F src/vdbemem.c bfc25f9ef4fa914b473303566459552bdb2e008a
F src/vtab.c 00902f289521041712fb0293d0bf8688c7af8e48 F src/vtab.c 00902f289521041712fb0293d0bf8688c7af8e48
F src/walker.c 1edca756275f158b80f20eb6f104c8d3fcc96a04 F src/walker.c 1edca756275f158b80f20eb6f104c8d3fcc96a04
F src/where.c cf0d091748c2fa6f7df96e5b08d2db26fd2eb437 F src/where.c cf0d091748c2fa6f7df96e5b08d2db26fd2eb437
@@ -741,7 +741,7 @@ 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
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 5260e8b1048af2e00d49706466d9aded90c24ed2 P 2594f01c73301f9432be9d007a079a19a3d383f9
R 14853fced115ae521390a355c09db2d4 R 03f11c535350a2a8405771e3c1db3be7
U danielk1977 U drh
Z 0b5e9ddfa58a9d8ba46a6641e5839200 Z 9fd8a2f528377ba3ce110f614bfe1ae6

View File

@@ -1 +1 @@
2594f01c73301f9432be9d007a079a19a3d383f9 375fd6f9c54fa5aa8cfae30845c7bfc0ec49e8fa

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.699 2009/07/22 14:08:14 danielk1977 Exp $ ** $Id: btree.c,v 1.700 2009/07/22 18:07:41 drh 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.
@@ -3775,25 +3775,19 @@ static int accessPayload(
** "amt" bytes will be transfered into pBuf[]. The transfer ** "amt" bytes will be transfered into pBuf[]. The transfer
** begins at "offset". ** begins at "offset".
** **
** The caller must ensure that pCur is pointing to a valid row
** in the table.
**
** Return SQLITE_OK on success or an error code if anything goes ** Return SQLITE_OK on success or an error code if anything goes
** wrong. An error is returned if "offset+amt" is larger than ** wrong. An error is returned if "offset+amt" is larger than
** the available payload. ** the available payload.
*/ */
int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
int rc;
assert( cursorHoldsMutex(pCur) ); assert( cursorHoldsMutex(pCur) );
rc = restoreCursorPosition(pCur);
if( rc==SQLITE_OK ){
assert( pCur->eState==CURSOR_VALID ); assert( pCur->eState==CURSOR_VALID );
assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] ); assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );
if( pCur->apPage[0]->intKey ){
return SQLITE_CORRUPT_BKPT;
}
assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell ); assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );
rc = accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0); return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
}
return rc;
} }
/* /*
@@ -5413,7 +5407,7 @@ static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
assert( sqlite3PagerIswriteable(pParent->pDbPage) ); assert( sqlite3PagerIswriteable(pParent->pDbPage) );
assert( pPage->nOverflow==1 ); assert( pPage->nOverflow==1 );
if( NEVER(pPage->nCell<=0) ) return SQLITE_CORRUPT_BKPT; if( pPage->nCell<=0 ) return SQLITE_CORRUPT_BKPT;
/* Allocate a new page. This page will become the right-sibling of /* Allocate a new page. This page will become the right-sibling of
** pPage. Make the parent page writable, so that the new divider cell ** pPage. Make the parent page writable, so that the new divider cell

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.151 2009/07/18 14:36:24 danielk1977 Exp $ ** $Id: vdbemem.c,v 1.152 2009/07/22 18:07:41 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "vdbeInt.h" #include "vdbeInt.h"
@@ -875,6 +875,8 @@ int sqlite3VdbeMemFromBtree(
int available = 0; /* Number of bytes available on the local btree page */ int available = 0; /* Number of bytes available on the local btree page */
int rc = SQLITE_OK; /* Return code */ int rc = SQLITE_OK; /* Return code */
assert( sqlite3BtreeCursorIsValid(pCur) );
/* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert()
** that both the BtShared and database handle mutexes are held. */ ** that both the BtShared and database handle mutexes are held. */
assert( (pMem->flags & MEM_RowSet)==0 ); assert( (pMem->flags & MEM_RowSet)==0 );