-C Update\sthe\swebpage\sdescription\sof\s3.2.6\schanges\sto\stalk\sabout\sticket\s#1432.\s(CVS\s2708)
-D 2005-09-17T15:17:40
+C Changes\sto\smake\scorruption\serrors\seasier\sto\strack\sdown.\s(CVS\s2709)
+D 2005-09-17T15:20:27
F Makefile.in 12784cdce5ffc8dfb707300c34e4f1eb3b8a14f1
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/analyze.c 43a2d91242bdd71b6c299378f6b11e896ee5e43d
F src/attach.c 4b21689700a72ae281fa85dbaff06b2a62bd49ee
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
-F src/btree.c a83b30bf0a533d1d56476678bbb79c58d2132838
+F src/btree.c 236126155d5607da945d33514218cbec762d887e
F src/btree.h 1ed561263ca0e335bc3e81d761c9d5ff8c22f61e
F src/build.c 74653e045581bfbadb8b35a0cb38a62f4a2c850e
F src/callback.c 9a1162c8f9dae9fad6d548339669aacb5f6cf76b
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 484c73bc1309f283a31baa0e114f3ee980536397
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
-F src/main.c bf88855445d365b497070d85e3faa0579a9edb91
+F src/main.c 422014201f22aa17b96c76650163178a91a825af
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
-F src/os.h 5a0a42555a750f334b7da973776803a0e3cc263a
-F src/os_common.h fb2aa1b3ca31f7292e8b6e1c9420c2f825f0b1e5
+F src/os.h c51f2747f7bd1840447e2c7d26db749604626814
+F src/os_common.h 1ff88c7e7e6bd3e5f85443106c91cc26a4f8600b
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c c86cf43b7ca9200e6fb7bc202ad2cc7da2f69367
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c ed03a35b2894f9b99840415f941a9f8594dea756
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 68b059546919456925a90c5c30c451642f07893c
+F src/pager.c adbb27f13ac75cd5bc29a3d84803e0cab1edfa88
F src/pager.h 17b13225abd93c1e9f470060f40a21b9edb5a164
F src/parse.y 5602d5cb894dda2932bf50b7e88782a4440ae3ae
F src/pragma.c 69413fbdc0c6aaa493a776ea52c1b3e6cf35dfb2
F src/select.c 9ef1dddd436e1ea86a6bf64ae0ed71bf4a0b894f
F src/shell.c 3596c1e559b82663057940d19ba533ad421c7dd3
F src/sqlite.h.in 461b2535550cf77aedfd44385da11ef7d63e57a2
-F src/sqliteInt.h cc685a74a0458bc41a34131e7c0b217654558b6c
+F src/sqliteInt.h cc5874662b2b3236e2d70a23429561b9f469c423
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c ac94682f9e601dd373912c46414a5a842db2089a
F src/test1.c b569b60e35f0e3ea20e5ebfaf6e522a01c08d481
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c fa99c441e8ff52c75cde944ea73ea39f6d5a2a09
F src/vacuum.c 829d9e1a6d7c094b80e0899686670932eafd768c
-F src/vdbe.c 3cbb9bb5ab70c9587e39a219a2c007ad7bfc70b5
+F src/vdbe.c de007d59f036fcd1b89a7d4172aa0d028e8689eb
F src/vdbe.h c8e105979fc7aaf5b8004e9621904e3bd096dfa2
F src/vdbeInt.h 3dd2a29c7b0a55404c35f93caae81fb42f4cb70a
F src/vdbeapi.c 85bbe1d0243a89655433d60711b4bd71979b59cd
-F src/vdbeaux.c e3a815a88bbf68f17880f5bc077e1c35d14b9409
+F src/vdbeaux.c b1db8b87935e7c864e6cdd9e39e07b6efdc2f576
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c fea0744936008831daa17cdc75056c3ca1469690
F src/where.c 1cc55c9aa142c7ef09b427f5fd0bf0488e365fc4
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782
F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b
-F test/tester.tcl 98ecdc5723b3b2be5a8a5c3a7f38fa53031466ee
+F test/tester.tcl 1e75553d320f5d2720613d8483c934488fc2c56f
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 553b7ba8f8ae4cb865494f2d301690149d7edb9f
-R 8d1e61fc6f8991d406d873110f916835
+P 0e23c28b25aced292cb068bc9a202cb627ba38ec
+R d840a4aee99798668c3447332ee407db
U drh
-Z 7704cf86f431264a6d16e778f11a63db
+Z 45298cf04a67874db88d26d3bf9dc754
-0e23c28b25aced292cb068bc9a202cb627ba38ec
\ No newline at end of file
+c07330000b9427a77f412918078beffa18de2c36
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.268 2005/09/16 11:32:18 drh Exp $
+** $Id: btree.c,v 1.269 2005/09/17 15:20:27 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
assert( pBt->autoVacuum );
if( key==0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
iPtrmap = PTRMAP_PAGENO(pBt->usableSize, key);
rc = sqlite3pager_get(pBt->pPager, iPtrmap, (void **)&pPtrmap);
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
sqlite3pager_unref(pPtrmap);
- if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT;
+ if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
return SQLITE_OK;
}
assert( pPage->aData == &((unsigned char*)pPage)[-pBt->pageSize] );
if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){
/* The parent page should never change unless the file is corrupt */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
if( pPage->isInit ) return SQLITE_OK;
if( pPage->pParent==0 && pParent!=0 ){
pPage->nCell = get2byte(&data[hdr+3]);
if( pPage->nCell>MX_CELL(pBt) ){
/* To many cells for a single page. The page must be corrupt */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){
/* All pages must have at least one cell, except for root pages */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
/* Compute the total free space on the page */
int next, size;
if( pc>usableSize-4 ){
/* Free block is off the page */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
next = get2byte(&data[pc]);
size = get2byte(&data[pc+2]);
if( next>0 && next<=pc+size+3 ){
/* Free blocks must be in accending order */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
nFree += size;
pc = next;
pPage->nFree = nFree;
if( nFree>=usableSize ){
/* Free space cannot exceed total page size */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
pPage->isInit = 1;
){
int rc;
if( pgno==0 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
rc = getPage(pBt, pgno, ppPage);
if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){
if( eType==PTRMAP_OVERFLOW2 ){
/* The pointer is always the first 4 bytes of the page in this case. */
if( get4byte(pPage->aData)!=iFrom ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
put4byte(pPage->aData, iTo);
}else{
if( i==nCell ){
if( eType!=PTRMAP_BTREE ||
get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
}
assert( pBt->autoVacuum );
if( PTRMAP_ISPAGE(pgsz, sqlite3pager_pagecount(pPager)) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
/* Figure out how many free-pages are in the database. If there are no
rc = ptrmapGet(pBt, iDbPage, &eType, &iPtrPage);
if( rc!=SQLITE_OK ) goto autovacuum_out;
if( eType==PTRMAP_ROOTPAGE ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto autovacuum_out;
}
}
if( amt>0 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
return SQLITE_OK;
}
assert( pCur->isValid );
assert( pCur->pPage!=0 );
if( pCur->pPage->intKey ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
assert( pCur->pPage->intKey==0 );
assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
pCur->idx = 0;
pCur->info.nSize = 0;
if( pNewPage->nCell<1 ){
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
return SQLITE_OK;
}
lwr = 0;
upr = pPage->nCell-1;
if( !pPage->intKey && pKey==0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
pageIntegrity(pPage);
while( lwr<=upr ){
TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
}else if( k>pBt->usableSize/4 - 8 ){
/* Value of k is out of range. Database corruption */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
#ifndef SQLITE_OMIT_AUTOVACUUM
}else if( searchList && nearby==iTrunk ){
/* The list is being searched and this trunk page is the page
*pPgno = iPage;
if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){
/* Free page off the end of the file */
- return SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ return SQLITE_CORRUPT_BKPT;
}
TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
": %d more free pages\n",
while( ovflPgno!=0 ){
MemPage *pOvfl;
if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = getPage(pBt, ovflPgno, &pOvfl);
if( rc ) return rc;
rc = sqlite3BtreeNext(&leafCur, ¬Used);
if( rc!=SQLITE_OK ){
if( rc!=SQLITE_NOMEM ){
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT_BKPT;
}
}
if( rc==SQLITE_OK ){
int i;
if( pgno>sqlite3pager_pagecount(pBt->pPager) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = getAndInitPage(pBt, pgno, &pPage, pParent);
}
for(i=nPage+1; rc==SQLITE_OK && i<=nToPage; i++){
void *pPage;
+ if( i==iSkip ) continue;
rc = sqlite3pager_get(pBtTo->pPager, i, &pPage);
if( rc ) break;
rc = sqlite3pager_write(pPage);
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.301 2005/09/07 21:22:46 drh Exp $
+** $Id: main.c,v 1.302 2005/09/17 15:20:27 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
int sqlite3_get_autocommit(sqlite3 *db){
return db->autoCommit;
}
+
+#ifdef SQLITE_DEBUG
+/*
+** The following routine is subtituted for constant SQLITE_CORRUPT in
+** debugging builds. This provides a way to set a breakpoint for when
+** corruption is first detected.
+*/
+int sqlite3Corrupt(void){
+ return SQLITE_CORRUPT;
+}
+#endif
#ifndef SQLITE_TEST
#define PENDING_BYTE 0x40000000 /* First byte past the 1GB boundary */
#else
-/* Defined in test2.c (pager tests) */
extern unsigned int sqlite3_pending_byte;
#define PENDING_BYTE sqlite3_pending_byte
#endif
* pending-byte in the database file.
*/
#ifdef SQLITE_TEST
-unsigned int sqlite3_pending_byte = 0x0010000;
+unsigned int sqlite3_pending_byte = 0x40000000;
#endif
int sqlite3_os_trace = 0;
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.214 2005/09/16 17:16:53 drh Exp $
+** @(#) $Id: pager.c,v 1.215 2005/09/17 15:20:27 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
end_stmt_playback:
if( rc!=SQLITE_OK ){
pPager->errMask |= PAGER_ERR_CORRUPT;
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT;
}else{
pPager->journalOff = szJ;
/* pager_reload_cache(pPager); */
** number greater than this, or zero, is requested.
*/
if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
/* Make sure we have not hit any critical errors.
rc = pager_playback(pPager);
}
if( rc!=SQLITE_OK ){
- rc = SQLITE_CORRUPT; /* bkpt-CORRUPT */
+ rc = SQLITE_CORRUPT_BKPT;
pPager->errMask |= PAGER_ERR_CORRUPT;
}
pPager->dbSize = -1;
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.418 2005/09/16 02:38:11 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.419 2005/09/17 15:20:27 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
*/
extern int sqlite3_always_code_trigger_setup;
+/*
+** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production
+** builds) or a function call (for debugging). If it is a function call,
+** it allows the operator to set a breakpoint at the spot where database
+** corruption is first detected.
+*/
+#ifdef SQLITE_DEBUG
+ extern int sqlite3Corrupt(void);
+# define SQLITE_CORRUPT_BKPT sqlite3Corrupt()
+#else
+# define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT
+#endif
+
/*
** Internal function prototypes
*/
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.487 2005/09/16 02:38:11 drh Exp $
+** $Id: vdbe.c,v 1.488 2005/09/17 15:20:28 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
** we are dealing with a malformed record.
*/
if( idx!=szHdr || offset!=payloadSize ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto op_column_out;
}
** only mean that we are dealing with a corrupt database file
*/
if( (flags & 0xf0)!=0 || ((flags & 0x07)!=5 && (flags & 0x07)!=2) ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
pCur->isTable = (flags & BTREE_INTKEY)!=0;
*/
if( (pCur->isTable && pOp->p3type==P3_KEYINFO)
|| (pCur->isIndex && pOp->p3type!=P3_KEYINFO) ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
break;
cnt = 0;
if( (sqlite3BtreeFlags(pC->pCursor)&(BTREE_INTKEY|BTREE_ZERODATA)) !=
BTREE_INTKEY ){
- rc = SQLITE_CORRUPT;
+ rc = SQLITE_CORRUPT_BKPT;
goto abort_due_to_error;
}
assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_INTKEY)!=0 );
sqlite3BtreeKeySize(pCur, &nCellKey);
if( nCellKey<=0 ){
- return SQLITE_CORRUPT;
+ return SQLITE_CORRUPT_BKPT;
}
rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
if( rc ){
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
-# $Id: tester.tcl,v 1.49 2005/05/26 15:20:53 danielk1977 Exp $
+# $Id: tester.tcl,v 1.50 2005/09/17 15:20:28 drh Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not.
}
set tcl_precision 15
+set sqlite_pending_byte 0x0010000
# Use the pager codec if it is available
#