Change the name of the sanity_check PRAGMA to "integrity_check" and make
it available on all compiles. (CVS 381) FossilOrigin-Name: c6e9048e66c8d8e2d5f6c62aa724eef3e9d9f572
This commit is contained in:
parent
a80a1e6ae4
commit
aaab5725db
46
manifest
46
manifest
@ -1,9 +1,9 @@
|
||||
C Version\s2.3.3\s(CVS\s444)
|
||||
D 2002-02-19T00:30:00
|
||||
C Change\sthe\sname\sof\sthe\ssanity_check\sPRAGMA\sto\s"integrity_check"\sand\smake\nit\savailable\son\sall\scompiles.\s(CVS\s381)
|
||||
D 2002-02-19T13:39:21
|
||||
F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af
|
||||
F Makefile.template 3372d45f8853afdb70bd30cc6fb50a3cd9069834
|
||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||
F VERSION 2a28a4c7b0e2dcb4280c5d1ae38ac7facdb3282b
|
||||
F VERSION 80c0f75cf7de338f1c6c31c07f5576d21f764431
|
||||
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
|
||||
F config.guess f38b1e93d1e0fa6f5a6913e9e7b12774b9232588
|
||||
F config.log 6a73d03433669b10a3f0c221198c3f26b9413914
|
||||
@ -19,23 +19,23 @@ F ltmain.sh e9ed72eb1d690f447c13945eaf69e28af531eda1
|
||||
F publish.sh 5b59f4aff037aafa0e4a3b6fa599495dbd73f360
|
||||
F sqlite.1 2e2bb0529ef468ade9e4322bd609d0695fb9ded9
|
||||
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
|
||||
F src/btree.c 340254ee2ea8b3bd8b60f9768b20382b4909eec0
|
||||
F src/btree.h b131caa44354d0305734d87b1c71440b4c436608
|
||||
F src/build.c 955a0094f4af52dc23293b17349ff1a0ae990eb2
|
||||
F src/btree.c 715209d8fff117d2e3024134c5b626f440fb0395
|
||||
F src/btree.h 9fd16f33b9f2efe733fecff7ca000d2950a74d9f
|
||||
F src/build.c 088acf87a92b00edda1206ccafac3518660b1b3b
|
||||
F src/delete.c f8ad71be53cf18656b6573de65395852fe817f0c
|
||||
F src/expr.c 7aff65ea0732b07d36925087ad611019103ad69a
|
||||
F src/hash.c 8f7c740ef2eaaa8decfa8751f2be30680b123e46
|
||||
F src/hash.h d1ce47900c7325af5e41c4feb4855c4bf2b841e7
|
||||
F src/insert.c 9453cbba2a62f8a2fb37d77cbdc5c84aa24752d7
|
||||
F src/insert.c eae5aa2e9ac68c4d465e71b2ad34bcbb882979cf
|
||||
F src/main.c 669cfd9a8c40f6c9ff2d478e1695d1ea1fdafad1
|
||||
F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
|
||||
F src/os.c f6bc9b7ab530346bb7fef2ed39f2f1f214bc14ea
|
||||
F src/os.h a17596ecc7f38a228b83ecdb661fb03ce44726d6
|
||||
F src/pager.c d261a3a0b4e96a400ef5432297edec09b041e9c7
|
||||
F src/pager.c 9761c79ccb844bf29ffc5cbed4fa1a32e0740147
|
||||
F src/pager.h b28f004e2f5541dc60cc32db01bf80cf4d056283
|
||||
F src/parse.y b82278917959eefd05bd08c90e07a4fa5917ea51
|
||||
F src/printf.c 300a90554345751f26e1fc0c0333b90a66110a1d
|
||||
F src/random.c f6b36bec5ebd3edb3440224bf5bf811fe4ac9a1b
|
||||
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
||||
F src/select.c d2bbaf4cba97b4c40503d0dc47e8b729e7088e0b
|
||||
F src/shell.c c102dfe388c7618a668c944ff157c49cb48f28e3
|
||||
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
||||
@ -45,28 +45,28 @@ F src/table.c c89698bd5bb4b8d14722d6ee7e9be014c383d24a
|
||||
F src/tclsqlite.c b9cf346e95291cb4c4f1bf5ac1d77db6b8ad023d
|
||||
F src/test1.c 33efd350dca27c52c58c553c04fd3a6a51f13c1f
|
||||
F src/test2.c d410dbd8a90faa466c3ab694fa0aa57f5a773aa6
|
||||
F src/test3.c d6775f95fd91f5b3cf0e2382a28e5aaeb68f745b
|
||||
F src/test3.c 4e52fff8b01f08bd202f7633feda5639b7ba2b5e
|
||||
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
||||
F src/tokenize.c 9e98f94469694a763992860596137e78dbae0cc0
|
||||
F src/update.c 95459f94a061860bf8e5716b3426a5ba85c79103
|
||||
F src/util.c f31f3d6198a0d1296a16f5a6ceec423a932cbbf6
|
||||
F src/vdbe.c 94704a5733db95b78cc902208c5e8e26a784e7f8
|
||||
F src/vdbe.h 3d49d22ba9ad14ea0e380bc582ff57347eaddb59
|
||||
F src/vdbe.c 3c788341b581c9381ab2ecd4868041ed57ff27ad
|
||||
F src/vdbe.h 20a662572485329cb0a6b648bf7c8cb6baec401d
|
||||
F src/where.c f79bc3179379b46b131a67ab10713779368dceee
|
||||
F test/all.test 7a8a8a7a579ed2bb4d8976d55402f21eacd58049
|
||||
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
|
||||
F test/btree.test 6ab4dc5f595905a276ef588fad3c9236dc07a47b
|
||||
F test/btree2.test 08e9485619265cbaf5d11bd71f357cdc26bb87e0
|
||||
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
|
||||
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
|
||||
F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
|
||||
F test/conflict.test 7c7dbfdfaee24453237eff3570a93dab56cb755a
|
||||
F test/copy.test 6691f7f671a0521361b27c4ef6e5d340604d3b5c
|
||||
F test/conflict.test c794c6c8f6e59918107dbab2d201ae454bb47db8
|
||||
F test/copy.test b3cefcb520c64d7e7dfedbab06b4d4c31fa5b99a
|
||||
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
|
||||
F test/expr.test c8a495050dcec3f9e68538c3ef466726933302c1
|
||||
F test/func.test 51dbe3f8a4c28972751697423e6acc5d6b551df1
|
||||
F test/in.test c09312672e3f0709fa02c8e2e9cd8fb4bd6269aa
|
||||
F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
|
||||
F test/insert.test 68c71b2fe6ad5b879845a1a70390955316fec68d
|
||||
F test/insert2.test 3fd6547056114bbb2da1d8cd7778affda4a30a12
|
||||
F test/insert.test c36d534a4ab58c2cd452a273e51b2b0dd1ede1f9
|
||||
F test/insert2.test 65c2b2aae0bae7a7bbe500f77981cd916b81e91b
|
||||
F test/intpkey.test ce3de8326082929667cf356855426519cfe2f5c7
|
||||
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
|
||||
F test/limit.test a930f3eba2a7691c8397ccab33710b931589566a
|
||||
@ -109,7 +109,7 @@ F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
|
||||
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
|
||||
F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b
|
||||
F www/c_interface.tcl 82a026b1681757f13b3f62e035f3a31407c1d353
|
||||
F www/changes.tcl e6b0f326e81e48ec48440e082424c36fc8fd034e
|
||||
F www/changes.tcl 7f9375639b6fefe75670e1881a2ccdc144c6230a
|
||||
F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2
|
||||
F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060
|
||||
F www/download.tcl a6d75b8b117cd33dcb090bef7e80d7556d28ebe0
|
||||
@ -117,14 +117,14 @@ F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
|
||||
F www/faq.tcl 32cbc134879871604070d4cc3a32e73fb22a35f9
|
||||
F www/formatchng.tcl 2d9a35c787823b48d72a5c64bb5414a43e26d5ad
|
||||
F www/index.tcl eacd99bcc3132d6e6b74a51422d415cc0bf7bfdf
|
||||
F www/lang.tcl 1712d94f9606b6b84982e697df0667b6a2cb1a5e
|
||||
F www/lang.tcl abf67afeb6527eb20b9088813160877fb413e933
|
||||
F www/mingw.tcl f1c7c0a7f53387dd9bb4f8c7e8571b7561510ebc
|
||||
F www/opcode.tcl bdec8ef9f100dbd87bbef8976c54b88e43fd8ccc
|
||||
F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5
|
||||
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
|
||||
F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
|
||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||
P a53de7625ac300ba3e61eed2e983010da8fa027b
|
||||
R 60f2c032a9501ddf7c5a624261445eae
|
||||
P 72c5a92aa6e3ae712af152cff8d1dc5b997b538e
|
||||
R 50515068ff6057399f03cf57fa91cbb8
|
||||
U drh
|
||||
Z 248336dd761a1f8d819852844c43fbf9
|
||||
Z 763c5eb79aff590e79bd0703f9429a9c
|
||||
|
@ -1 +1 @@
|
||||
72c5a92aa6e3ae712af152cff8d1dc5b997b538e
|
||||
c6e9048e66c8d8e2d5f6c62aa724eef3e9d9f572
|
29
src/btree.c
29
src/btree.c
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.52 2002/02/03 19:15:02 drh Exp $
|
||||
** $Id: btree.c,v 1.53 2002/02/19 13:39:22 drh Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@ -2458,15 +2458,13 @@ int sqliteBtreeUpdateMeta(Btree *pBt, int *aMeta){
|
||||
** The complete implementation of the BTree subsystem is above this line.
|
||||
** All the code the follows is for testing and troubleshooting the BTree
|
||||
** subsystem. None of the code that follows is used during normal operation.
|
||||
** All of the following code is omitted if the library is compiled with
|
||||
** the -DNDEBUG2=1 compiler option.
|
||||
******************************************************************************/
|
||||
#ifndef NDEBUG2
|
||||
|
||||
/*
|
||||
** Print a disassembly of the given page on standard output. This routine
|
||||
** is used for debugging and testing only.
|
||||
*/
|
||||
#ifdef SQLITE_TEST
|
||||
int sqliteBtreePageDump(Btree *pBt, int pgno, int recursive){
|
||||
int rc;
|
||||
MemPage *pPage;
|
||||
@ -2535,7 +2533,9 @@ int sqliteBtreePageDump(Btree *pBt, int pgno, int recursive){
|
||||
sqlitepager_unref(pPage);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_TEST
|
||||
/*
|
||||
** Fill aResult[] with information about the entry and page that the
|
||||
** cursor is pointing to.
|
||||
@ -2575,7 +2575,9 @@ int sqliteBtreeCursorDump(BtCursor *pCur, int *aResult){
|
||||
aResult[7] = pPage->u.hdr.rightChild;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_TEST
|
||||
/*
|
||||
** Return the pager associated with a BTree. This routine is used for
|
||||
** testing and debugging only.
|
||||
@ -2583,13 +2585,14 @@ int sqliteBtreeCursorDump(BtCursor *pCur, int *aResult){
|
||||
Pager *sqliteBtreePager(Btree *pBt){
|
||||
return pBt->pPager;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** This structure is passed around through all the sanity checking routines
|
||||
** in order to keep track of some global state information.
|
||||
*/
|
||||
typedef struct SanityCheck SanityCheck;
|
||||
struct SanityCheck {
|
||||
typedef struct IntegrityCk IntegrityCk;
|
||||
struct IntegrityCk {
|
||||
Btree *pBt; /* The tree being checked out */
|
||||
Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
|
||||
int nPage; /* Number of pages in the database */
|
||||
@ -2602,7 +2605,7 @@ struct SanityCheck {
|
||||
/*
|
||||
** Append a message to the error message string.
|
||||
*/
|
||||
static void checkAppendMsg(SanityCheck *pCheck, char *zMsg1, char *zMsg2){
|
||||
static void checkAppendMsg(IntegrityCk *pCheck, char *zMsg1, char *zMsg2){
|
||||
if( pCheck->zErrMsg ){
|
||||
char *zOld = pCheck->zErrMsg;
|
||||
pCheck->zErrMsg = 0;
|
||||
@ -2621,7 +2624,7 @@ static void checkAppendMsg(SanityCheck *pCheck, char *zMsg1, char *zMsg2){
|
||||
**
|
||||
** Also check that the page number is in bounds.
|
||||
*/
|
||||
static int checkRef(SanityCheck *pCheck, int iPage, char *zContext){
|
||||
static int checkRef(IntegrityCk *pCheck, int iPage, char *zContext){
|
||||
if( iPage==0 ) return 1;
|
||||
if( iPage>pCheck->nPage ){
|
||||
char zBuf[100];
|
||||
@ -2642,7 +2645,7 @@ static int checkRef(SanityCheck *pCheck, int iPage, char *zContext){
|
||||
** Check the integrity of the freelist or of an overflow page list.
|
||||
** Verify that the number of pages on the list is N.
|
||||
*/
|
||||
static void checkList(SanityCheck *pCheck, int iPage, int N, char *zContext){
|
||||
static void checkList(IntegrityCk *pCheck, int iPage, int N, char *zContext){
|
||||
char zMsg[100];
|
||||
while( N-- ){
|
||||
OverflowPage *pOvfl;
|
||||
@ -2698,7 +2701,7 @@ static int keyCompare(
|
||||
** the root of the tree.
|
||||
*/
|
||||
static int checkTreePage(
|
||||
SanityCheck *pCheck, /* Context for the sanity check */
|
||||
IntegrityCk *pCheck, /* Context for the sanity check */
|
||||
int iPage, /* Page number of the page to check */
|
||||
MemPage *pParent, /* Parent page */
|
||||
char *zParentContext, /* Parent context */
|
||||
@ -2843,10 +2846,10 @@ static int checkTreePage(
|
||||
** and a pointer to that error message is returned. The calling function
|
||||
** is responsible for freeing the error message when it is done.
|
||||
*/
|
||||
char *sqliteBtreeSanityCheck(Btree *pBt, int *aRoot, int nRoot){
|
||||
char *sqliteBtreeIntegrityCheck(Btree *pBt, int *aRoot, int nRoot){
|
||||
int i;
|
||||
int nRef;
|
||||
SanityCheck sCheck;
|
||||
IntegrityCk sCheck;
|
||||
|
||||
nRef = *sqlitepager_stats(pBt->pPager);
|
||||
if( lockBtree(pBt)!=SQLITE_OK ){
|
||||
@ -2897,5 +2900,3 @@ char *sqliteBtreeSanityCheck(Btree *pBt, int *aRoot, int nRoot){
|
||||
sqliteFree(sCheck.anRef);
|
||||
return sCheck.zErrMsg;
|
||||
}
|
||||
|
||||
#endif /* !defined(NDEBUG) */
|
||||
|
@ -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.22 2002/02/03 19:15:02 drh Exp $
|
||||
** @(#) $Id: btree.h,v 1.23 2002/02/19 13:39:22 drh Exp $
|
||||
*/
|
||||
#ifndef _BTREE_H_
|
||||
#define _BTREE_H_
|
||||
@ -56,12 +56,12 @@ int sqliteBtreeCloseCursor(BtCursor*);
|
||||
int sqliteBtreeGetMeta(Btree*, int*);
|
||||
int sqliteBtreeUpdateMeta(Btree*, int*);
|
||||
|
||||
char *sqliteBtreeIntegrityCheck(Btree*, int*, int);
|
||||
|
||||
#ifndef NDEBUG2
|
||||
#ifdef SQLITE_TEST
|
||||
int sqliteBtreePageDump(Btree*, int, int);
|
||||
int sqliteBtreeCursorDump(BtCursor*, int*);
|
||||
struct Pager *sqliteBtreePager(Btree*);
|
||||
char *sqliteBtreeSanityCheck(Btree*, int*, int);
|
||||
#endif
|
||||
|
||||
#endif /* _BTREE_H_ */
|
||||
|
@ -25,7 +25,7 @@
|
||||
** ROLLBACK
|
||||
** PRAGMA
|
||||
**
|
||||
** $Id: build.c,v 1.76 2002/02/18 22:49:59 drh Exp $
|
||||
** $Id: build.c,v 1.77 2002/02/19 13:39:22 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -1799,8 +1799,7 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
||||
}else
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
if( sqliteStrICmp(zLeft, "sanity_check")==0 ){
|
||||
if( sqliteStrICmp(zLeft, "integrity_check")==0 ){
|
||||
static VdbeOp checkDb[] = {
|
||||
{ OP_SetInsert, 0, 0, "2"},
|
||||
{ OP_Open, 0, 2, 0},
|
||||
@ -1808,7 +1807,7 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
||||
{ OP_Column, 0, 3, 0},
|
||||
{ OP_SetInsert, 0, 0, 0},
|
||||
{ OP_Next, 0, 3, 0},
|
||||
{ OP_SanityCheck, 0, 0, 0},
|
||||
{ OP_IntegrityCk, 0, 0, 0},
|
||||
{ OP_ColumnCount, 1, 0, 0},
|
||||
{ OP_ColumnName, 0, 0, "sanity_check"},
|
||||
{ OP_Callback, 1, 0, 0},
|
||||
@ -1817,7 +1816,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
||||
if( v==0 ) return;
|
||||
sqliteVdbeAddOpList(v, ArraySize(checkDb), checkDb);
|
||||
}else
|
||||
#endif
|
||||
|
||||
{}
|
||||
sqliteFree(zLeft);
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle INSERT statements in SQLite.
|
||||
**
|
||||
** $Id: insert.c,v 1.43 2002/02/18 13:56:37 drh Exp $
|
||||
** $Id: insert.c,v 1.44 2002/02/19 13:39:22 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -368,7 +368,7 @@ insert_cleanup:
|
||||
** is used. Or if pParse->onError==OE_Default then the onError value
|
||||
** for the constraint is used.
|
||||
**
|
||||
** The calling routine must an open read/write cursor for pTab with
|
||||
** The calling routine must open a read/write cursor for pTab with
|
||||
** cursor number "base". All indices of pTab must also have open
|
||||
** read/write cursors with cursor number base+i for the i-th cursor.
|
||||
** Except, if there is no possibility of a REPLACE action then
|
||||
|
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.39 2002/02/14 12:50:35 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.40 2002/02/19 13:39:22 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "pager.h"
|
||||
@ -653,7 +653,7 @@ int sqlitepager_ref(void *pData){
|
||||
**
|
||||
** Writing all free dirty pages to the database after the sync is a
|
||||
** non-obvious optimization. fsync() is an expensive operation so we
|
||||
** want to minimize the number it is called. After an fsync() call,
|
||||
** want to minimize the number ot times it is called. After an fsync() call,
|
||||
** we are free to write dirty pages back to the database. It is best
|
||||
** to go ahead and write as many dirty pages as possible to minimize
|
||||
** the risk of having to do another fsync() later on. Writing dirty
|
||||
@ -1234,7 +1234,7 @@ int *sqlitepager_stats(Pager *pPager){
|
||||
**
|
||||
** This routine should be called with the transaction journal already
|
||||
** open. A new checkpoint journal is created that can be used to rollback
|
||||
** changes of a single command within a larger transaction.
|
||||
** changes of a single SQL command within a larger transaction.
|
||||
*/
|
||||
int sqlitepager_ckpt_begin(Pager *pPager){
|
||||
int rc;
|
||||
|
@ -15,7 +15,7 @@
|
||||
** Random numbers are used by some of the database backends in order
|
||||
** to generate random integer keys for tables or random filenames.
|
||||
**
|
||||
** $Id: random.c,v 1.9 2002/01/16 21:00:27 drh Exp $
|
||||
** $Id: random.c,v 1.10 2002/02/19 13:39:23 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -31,7 +31,7 @@
|
||||
** well be good enough. But maybe not. Or maybe lrand48() has some
|
||||
** subtle problems on some systems that could cause problems. It is hard
|
||||
** to know. To minimize the risk of problems due to bad lrand48()
|
||||
** implementations, SQLite uses is this random number generator based
|
||||
** implementations, SQLite uses this random number generator based
|
||||
** on RC4, which we know works very well.
|
||||
*/
|
||||
static int randomByte(){
|
||||
|
10
src/test3.c
10
src/test3.c
@ -13,7 +13,7 @@
|
||||
** is not included in the SQLite library. It is used for automated
|
||||
** testing of the SQLite library.
|
||||
**
|
||||
** $Id: test3.c,v 1.13 2001/11/09 13:41:10 drh Exp $
|
||||
** $Id: test3.c,v 1.14 2002/02/19 13:39:23 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "pager.h"
|
||||
@ -461,13 +461,13 @@ static int btree_pager_ref_dump(
|
||||
}
|
||||
|
||||
/*
|
||||
** Usage: btree_sanity_check ID ROOT ...
|
||||
** Usage: btree_integrity_check ID ROOT ...
|
||||
**
|
||||
** Look through every page of the given BTree file to verify correct
|
||||
** formatting and linkage. Return a line of text for each problem found.
|
||||
** Return an empty string if everything worked.
|
||||
*/
|
||||
static int btree_sanity_check(
|
||||
static int btree_integrity_check(
|
||||
void *NotUsed,
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int argc, /* Number of arguments */
|
||||
@ -490,7 +490,7 @@ static int btree_sanity_check(
|
||||
for(i=0; i<argc-2; i++){
|
||||
if( Tcl_GetInt(interp, argv[i+2], &aRoot[i]) ) return TCL_ERROR;
|
||||
}
|
||||
zResult = sqliteBtreeSanityCheck(pBt, aRoot, nRoot);
|
||||
zResult = sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot);
|
||||
if( zResult ){
|
||||
Tcl_AppendResult(interp, zResult, 0);
|
||||
free(zResult);
|
||||
@ -833,7 +833,7 @@ int Sqlitetest3_Init(Tcl_Interp *interp){
|
||||
Tcl_CreateCommand(interp, "btree_key", btree_key, 0, 0);
|
||||
Tcl_CreateCommand(interp, "btree_data", btree_data, 0, 0);
|
||||
Tcl_CreateCommand(interp, "btree_cursor_dump", btree_cursor_dump, 0, 0);
|
||||
Tcl_CreateCommand(interp, "btree_sanity_check", btree_sanity_check, 0, 0);
|
||||
Tcl_CreateCommand(interp, "btree_integrity_check", btree_integrity_check,0,0);
|
||||
Tcl_LinkVar(interp, "pager_refinfo_enable", (char*)&pager_refinfo_enable,
|
||||
TCL_LINK_INT);
|
||||
return TCL_OK;
|
||||
|
16
src/vdbe.c
16
src/vdbe.c
@ -30,7 +30,7 @@
|
||||
** But other routines are also provided to help in building up
|
||||
** a program instruction by instruction.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.117 2002/02/03 19:06:03 drh Exp $
|
||||
** $Id: vdbe.c,v 1.118 2002/02/19 13:39:23 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -868,7 +868,7 @@ static char *zOpName[] = { 0,
|
||||
"IsUnique", "NotExists", "Delete", "Column",
|
||||
"KeyAsData", "Recno", "FullKey", "Rewind",
|
||||
"Next", "Destroy", "Clear", "CreateIndex",
|
||||
"CreateTable", "SanityCheck", "IdxPut", "IdxDelete",
|
||||
"CreateTable", "IntegrityCk", "IdxPut", "IdxDelete",
|
||||
"IdxRecno", "IdxGT", "IdxGE", "MemLoad",
|
||||
"MemStore", "ListWrite", "ListRewind", "ListRead",
|
||||
"ListReset", "SortPut", "SortMakeRec", "SortMakeKey",
|
||||
@ -3481,7 +3481,7 @@ case OP_CreateTable: {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Opcode: SanityCheck P1 * *
|
||||
/* Opcode: IntegrityCk P1 * *
|
||||
**
|
||||
** Do an analysis of the currently open database. Push onto the
|
||||
** stack the text of an error message describing any problems.
|
||||
@ -3492,8 +3492,7 @@ case OP_CreateTable: {
|
||||
**
|
||||
** This opcode is used for testing purposes only.
|
||||
*/
|
||||
case OP_SanityCheck: {
|
||||
#ifndef NDEBUG /* This opcode used for testing only */
|
||||
case OP_IntegrityCk: {
|
||||
int nRoot;
|
||||
int *aRoot;
|
||||
int tos = ++p->tos;
|
||||
@ -3503,8 +3502,8 @@ case OP_SanityCheck: {
|
||||
HashElem *i;
|
||||
char *z;
|
||||
|
||||
if( iSet<0 || iSet>=p->nSet ) goto bad_instruction;
|
||||
if( NeedStack(p, p->tos) ) goto no_mem;
|
||||
VERIFY( if( iSet<0 || iSet>=p->nSet ) goto bad_instruction; )
|
||||
VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; )
|
||||
pSet = &p->aSet[iSet];
|
||||
nRoot = sqliteHashCount(&pSet->hash);
|
||||
aRoot = sqliteMalloc( sizeof(int)*(nRoot+1) );
|
||||
@ -3512,7 +3511,7 @@ case OP_SanityCheck: {
|
||||
aRoot[j] = atoi((char*)sqliteHashKey(i));
|
||||
}
|
||||
aRoot[j] = 0;
|
||||
z = sqliteBtreeSanityCheck(pBt, aRoot, nRoot);
|
||||
z = sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot);
|
||||
if( z==0 || z[0]==0 ){
|
||||
zStack[tos] = "ok";
|
||||
aStack[tos].n = 3;
|
||||
@ -3524,7 +3523,6 @@ case OP_SanityCheck: {
|
||||
aStack[tos].flags = STK_Str | STK_Dyn;
|
||||
}
|
||||
sqliteFree(aRoot);
|
||||
#endif /* !define(NDEBUG) */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
** or VDBE. The VDBE implements an abstract machine that runs a
|
||||
** simple program to access and modify the underlying database.
|
||||
**
|
||||
** $Id: vdbe.h,v 1.41 2002/02/03 03:34:09 drh Exp $
|
||||
** $Id: vdbe.h,v 1.42 2002/02/19 13:39:23 drh Exp $
|
||||
*/
|
||||
#ifndef _SQLITE_VDBE_H_
|
||||
#define _SQLITE_VDBE_H_
|
||||
@ -104,7 +104,7 @@ typedef struct VdbeOp VdbeOp;
|
||||
#define OP_Clear 31
|
||||
#define OP_CreateIndex 32
|
||||
#define OP_CreateTable 33
|
||||
#define OP_SanityCheck 34
|
||||
#define OP_IntegrityCk 34
|
||||
|
||||
#define OP_IdxPut 35
|
||||
#define OP_IdxDelete 36
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is btree database backend
|
||||
#
|
||||
# $Id: btree.test,v 1.11 2001/11/23 00:24:12 drh Exp $
|
||||
# $Id: btree.test,v 1.12 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -986,7 +986,7 @@ do_test btree-12.12 {
|
||||
btree_key $::c1
|
||||
} {402}
|
||||
do_test btree-13.1 {
|
||||
btree_sanity_check $::b1 2 3
|
||||
btree_integrity_check $::b1 2 3
|
||||
} {}
|
||||
|
||||
# To Do:
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is btree database backend
|
||||
#
|
||||
# $Id: btree2.test,v 1.9 2001/10/22 02:58:11 drh Exp $
|
||||
# $Id: btree2.test,v 1.10 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -53,7 +53,7 @@ do_test btree2-1.5 {
|
||||
btree_delete $::c2
|
||||
btree_close_cursor $::c2
|
||||
btree_commit $::b
|
||||
btree_sanity_check $::b 2 3 4 5 6
|
||||
btree_integrity_check $::b 2 3 4 5 6
|
||||
} {}
|
||||
|
||||
# This test module works by making lots of pseudo-random changes to a
|
||||
@ -125,7 +125,7 @@ proc make_payload {keynum L len} {
|
||||
# success or an error message if something is amiss.
|
||||
#
|
||||
proc check_invariants {} {
|
||||
set ck [btree_sanity_check $::b 2 3 4 5 6]
|
||||
set ck [btree_integrity_check $::b 2 3 4 5 6]
|
||||
if {$ck!=""} {
|
||||
puts "\n*** SANITY:\n$ck"
|
||||
exit
|
||||
@ -259,7 +259,7 @@ proc random_changes {n I K D} {
|
||||
} elseif {[btree_move_to $::c6 $basekey]==0} {
|
||||
btree_delete $::c6
|
||||
}
|
||||
# set ck [btree_sanity_check $::b 2 3 4 5 6]
|
||||
# set ck [btree_integrity_check $::b 2 3 4 5 6]
|
||||
# if {$ck!=""} {
|
||||
# puts "\nSANITY CHECK FAILED!\n$ck"
|
||||
# exit
|
||||
|
@ -13,7 +13,7 @@
|
||||
# This file implements tests for the conflict resolution extension
|
||||
# to SQLite.
|
||||
#
|
||||
# $Id: conflict.test,v 1.7 2002/02/03 19:06:03 drh Exp $
|
||||
# $Id: conflict.test,v 1.8 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -378,7 +378,7 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
|
||||
}
|
||||
|
||||
do_test insert-99.1 {
|
||||
set x [execsql {PRAGMA sanity_check}]
|
||||
set x [execsql {PRAGMA integrity_check}]
|
||||
if {$x==""} {set x ok}
|
||||
set x
|
||||
} {ok}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the COPY statement.
|
||||
#
|
||||
# $Id: copy.test,v 1.9 2002/02/03 19:06:03 drh Exp $
|
||||
# $Id: copy.test,v 1.10 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -227,7 +227,7 @@ do_test copy-5.7 {
|
||||
} {0}
|
||||
|
||||
do_test copy-6.0 {
|
||||
set x [execsql {PRAGMA sanity_check}]
|
||||
set x [execsql {PRAGMA integrity_check}]
|
||||
if {$x==""} {set x ok}
|
||||
set x
|
||||
} {ok}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the INSERT statement.
|
||||
#
|
||||
# $Id: insert.test,v 1.8 2002/02/18 13:56:37 drh Exp $
|
||||
# $Id: insert.test,v 1.9 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -157,7 +157,7 @@ do_test insert-3.4 {
|
||||
execsql {SELECT * FROM test2 WHERE f1=22 AND f2=-4.44}
|
||||
} {22 -4.44 hi abc-123 wham}
|
||||
do_test insert-3.5 {
|
||||
set x [execsql {PRAGMA sanity_check}]
|
||||
set x [execsql {PRAGMA integrity_check}]
|
||||
if {$x==""} {set x ok}
|
||||
set x
|
||||
} {ok}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing the INSERT statement that takes is
|
||||
# result from a SELECT.
|
||||
#
|
||||
# $Id: insert2.test,v 1.6 2002/02/03 19:06:03 drh Exp $
|
||||
# $Id: insert2.test,v 1.7 2002/02/19 13:39:23 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -113,7 +113,7 @@ do_test insert2-2.3 {
|
||||
} {hi 2 1}
|
||||
|
||||
do_test insert2-4.0 {
|
||||
set x [execsql {PRAGMA sanity_check}]
|
||||
set x [execsql {PRAGMA integrity_check}]
|
||||
if {$x==""} {set x ok}
|
||||
set x
|
||||
} {ok}
|
||||
|
@ -17,6 +17,11 @@ proc chng {date desc} {
|
||||
puts "<DD><P><UL>$desc</UL></P></DD>"
|
||||
}
|
||||
|
||||
chng {2002 Feb * (2.3.4)} {
|
||||
<li>Change the name of the sanity_check PRAGMA to <b>integrity_check</b>
|
||||
and make it available in all compiles.</li>
|
||||
}
|
||||
|
||||
chng {2002 Feb 18 (2.3.3)} {
|
||||
<li>Allow identifiers to be quoted in square brackets, for compatibility
|
||||
with MS-Access.</li>
|
||||
@ -33,7 +38,7 @@ chng {2002 Feb 18 (2.3.3)} {
|
||||
chng {2002 Feb 14 (2.3.2)} {
|
||||
<li>Bug fix: There was an incorrect assert() in pager.c. The real code was
|
||||
all correct (as far as is known) so everything should work OK if you
|
||||
compile with -DNDEBUG=1. But without disability the assertions, there
|
||||
compile with -DNDEBUG=1. When asserts are not disabled, there
|
||||
could be a fault.</li>
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Run this Tcl script to generate the sqlite.html file.
|
||||
#
|
||||
set rcsid {$Id: lang.tcl,v 1.24 2002/02/18 18:30:33 drh Exp $}
|
||||
set rcsid {$Id: lang.tcl,v 1.25 2002/02/19 13:39:23 drh Exp $}
|
||||
|
||||
puts {<html>
|
||||
<head>
|
||||
@ -750,14 +750,12 @@ with caution.</p>
|
||||
This only works if the library is compiled without the NDEBUG macro.
|
||||
</p></li>
|
||||
|
||||
<li><p><b>PRAGMA sanity_check;</b></p>
|
||||
<li><p><b>PRAGMA integrity_check;</b></p>
|
||||
<p>The command does an integrity check of the entire database. It
|
||||
looks for out-of-order records, missing pages, and malformed records.
|
||||
If any problems are found, then a single string is returned which is
|
||||
a description of all problems. If everything is in order, "ok" is
|
||||
returned. This command is used for testing and debugging only and
|
||||
is not available if the library is compiled
|
||||
with the -DNDEBUG=1 compiler option.</p>
|
||||
returned.</p>
|
||||
|
||||
<li><p><b>PRAGMA table_info(</b><i>table-name</i><b>);</b></p>
|
||||
<p>For each column in the named table, invoke the callback function
|
||||
|
Loading…
x
Reference in New Issue
Block a user