mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Additional test coverage for the btree module. Remove the failsafe() macro
and replace it with ALWAYS() and NEVER(). (CVS 5395) FossilOrigin-Name: d7e2f0d2d45574d6191c1b191c0daf5260696f27
This commit is contained in:
32
manifest
32
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sminor\sproblems\sin\sthe\stest\sscripts\sand\sharness.\s(CVS\s5394)
|
C Additional\stest\scoverage\sfor\sthe\sbtree\smodule.\s\sRemove\sthe\sfailsafe()\smacro\nand\sreplace\sit\swith\sALWAYS()\sand\sNEVER().\s(CVS\s5395)
|
||||||
D 2008-07-11T13:53:55
|
D 2008-07-11T16:15:18
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
|
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -95,8 +95,8 @@ F src/attach.c b18ba42c77f7d3941f5d23d2ca20fa1d841a4e91
|
|||||||
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
||||||
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
|
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
|
||||||
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
|
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
|
||||||
F src/btree.c 6ec7584e5f61f2215cec8504ac6d330f1aa6765b
|
F src/btree.c 881d5eb6ec2a80421690537e68e63a91644bf3ef
|
||||||
F src/btree.h 9373128fbd6509a281e0d356cb15f9cffbfa876c
|
F src/btree.h 0063e9853aa1ffb55b46f0e798eea8934f032ffd
|
||||||
F src/btreeInt.h d59e58d39950a17c0fb7e004c90ab7696d3e7df5
|
F src/btreeInt.h d59e58d39950a17c0fb7e004c90ab7696d3e7df5
|
||||||
F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249
|
F src/build.c bac7233d984be3805aaa41cf500f7ee12dc97249
|
||||||
F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d
|
F src/callback.c aa492a0ad8c2d454edff9fb8a57fae13743cf71d
|
||||||
@@ -114,7 +114,7 @@ F src/insert.c e8efc17d037346e4a4a6949e72aab850befe3d5d
|
|||||||
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
||||||
F src/legacy.c 3626c71fb70912abec9a4312beba753a9ce800df
|
F src/legacy.c 3626c71fb70912abec9a4312beba753a9ce800df
|
||||||
F src/loadext.c ae0eed9fa96d74172d2a90ee63b5bc36d284295c
|
F src/loadext.c ae0eed9fa96d74172d2a90ee63b5bc36d284295c
|
||||||
F src/main.c ff7d9e39d014cc36246c334f6076e44e20db45ca
|
F src/main.c 453d54b33799bfa0adfdf8a97a196521f9d9e962
|
||||||
F src/malloc.c 226a532e9e371d1bb3de2553bdd1f9b600ef099c
|
F src/malloc.c 226a532e9e371d1bb3de2553bdd1f9b600ef099c
|
||||||
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
|
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
|
||||||
F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b
|
F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b
|
||||||
@@ -142,11 +142,11 @@ F src/printf.c 8e5d410220cf8650f502caf71f0de979a3f9031e
|
|||||||
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
||||||
F src/select.c fcf51df1818a448edebf55b032d89771ba4536ef
|
F src/select.c fcf51df1818a448edebf55b032d89771ba4536ef
|
||||||
F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0
|
F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0
|
||||||
F src/sqlite.h.in 8d25645bc8aee60e3089d05f3dbb8f66d1af0cd5
|
F src/sqlite.h.in a573ab3a22256fc6c28b8f27d5af446f2b712a31
|
||||||
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
||||||
F src/sqliteInt.h ca0dc923bcc51bef0064f34628bd6daeb0d68d38
|
F src/sqliteInt.h 83181862609629e04b99ae8087b46a7c9dcde7af
|
||||||
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
||||||
F src/status.c b8d7b1f6b518e71986dfa65058de7a714efd61be
|
F src/status.c 2076bc996618b1a112a797f05c1d62026ae01402
|
||||||
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
||||||
F src/tclsqlite.c ec46084184f033ba396a9ee7b5514b695083d0f3
|
F src/tclsqlite.c ec46084184f033ba396a9ee7b5514b695083d0f3
|
||||||
F src/test1.c 30bdb22f911efd492c4f49565eae014330231ece
|
F src/test1.c 30bdb22f911efd492c4f49565eae014330231ece
|
||||||
@@ -166,7 +166,7 @@ F src/test_devsym.c 6012cb8e3acf812513511025a4fa5d626e0ba19b
|
|||||||
F src/test_func.c ade4f0117cc96c5a05682e1ef38b84320a866ad9
|
F src/test_func.c ade4f0117cc96c5a05682e1ef38b84320a866ad9
|
||||||
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
|
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
|
||||||
F src/test_loadext.c df8ab3a6481ddebbdf0d28ebac5d9e0790f7860f
|
F src/test_loadext.c df8ab3a6481ddebbdf0d28ebac5d9e0790f7860f
|
||||||
F src/test_malloc.c 4f07302a0077f2c1730baa7aeb359e4f51960aa7
|
F src/test_malloc.c e655e3ff61845fc23886ee81973638e795477c9e
|
||||||
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
|
F src/test_md5.c 28209a4e2068711b5443c33104fe41f21d160071
|
||||||
F src/test_mutex.c 86a937f5d28f373b8495faf1347a9d0a306594d4
|
F src/test_mutex.c 86a937f5d28f373b8495faf1347a9d0a306594d4
|
||||||
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
|
F src/test_onefile.c 243157b10275251c5dc2d6619aee2ff9ae22379c
|
||||||
@@ -179,18 +179,18 @@ F src/tokenize.c b5fdc79fb7e00077b9c02af7a0da3b89c9f3398e
|
|||||||
F src/trigger.c bdb56bb9db1a7b18f8505484051221ab5123f21d
|
F src/trigger.c bdb56bb9db1a7b18f8505484051221ab5123f21d
|
||||||
F src/update.c 4e698fcc0c91c241a960304c4236dc3a49603155
|
F src/update.c 4e698fcc0c91c241a960304c4236dc3a49603155
|
||||||
F src/utf.c 8d52f620a7153d90b058502124fe51d821fcdf57
|
F src/utf.c 8d52f620a7153d90b058502124fe51d821fcdf57
|
||||||
F src/util.c 06dbffe992bfc69dd8e4462a6baf9528b706fa17
|
F src/util.c 172ebad4eb14eada6e2e1d0e202765b0e97905e4
|
||||||
F src/vacuum.c ef342828002debc97514617af3424aea8ef8522c
|
F src/vacuum.c ef342828002debc97514617af3424aea8ef8522c
|
||||||
F src/vdbe.c 14d98d1d47041a99a9c98034842772dbbcc062fb
|
F src/vdbe.c 14d98d1d47041a99a9c98034842772dbbcc062fb
|
||||||
F src/vdbe.h c46155c221418bea29ee3a749d5950fcf85a70e2
|
F src/vdbe.h c46155c221418bea29ee3a749d5950fcf85a70e2
|
||||||
F src/vdbeInt.h 30535c1d30ba1b5fb58d8f0e1d1261af976558aa
|
F src/vdbeInt.h 30535c1d30ba1b5fb58d8f0e1d1261af976558aa
|
||||||
F src/vdbeapi.c a7c6b8db324cf7eccff32de871dea36aa305c994
|
F src/vdbeapi.c a7c6b8db324cf7eccff32de871dea36aa305c994
|
||||||
F src/vdbeaux.c 734d27d1e18bb4fb3c7f94d499039a8d3bbf8407
|
F src/vdbeaux.c 24ecae4e3e7ebcfb604d6ef0dc268da2cfb3ffa7
|
||||||
F src/vdbeblob.c a20fe9345062b1a1b4cc187dc5fad45c9414033b
|
F src/vdbeblob.c a20fe9345062b1a1b4cc187dc5fad45c9414033b
|
||||||
F src/vdbefifo.c c46dae1194e4277bf007144d7e5b0c0b1c24f136
|
F src/vdbefifo.c c46dae1194e4277bf007144d7e5b0c0b1c24f136
|
||||||
F src/vdbemem.c 0c72b58ffd759676ce4829f42bacb83842a58c21
|
F src/vdbemem.c 0c72b58ffd759676ce4829f42bacb83842a58c21
|
||||||
F src/vtab.c 2096c03ec5540a43c8c73a8f43407dfd3549a982
|
F src/vtab.c 2096c03ec5540a43c8c73a8f43407dfd3549a982
|
||||||
F src/where.c 3324f8273a9c40d4b04b65cdef0a8c4954c1cce6
|
F src/where.c 087bfd37580cd1b289f534d5727630b247b00ba3
|
||||||
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
|
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/all.test ed6849e7a425620d5d4388409f3b15901b5bc2e7
|
F test/all.test ed6849e7a425620d5d4388409f3b15901b5bc2e7
|
||||||
@@ -483,7 +483,7 @@ F test/tableapi.test 892208d49e7be4817a4d3e4f641dbcbbee8cd03c
|
|||||||
F test/tclsqlite.test aa1781808502271feccfd24f9e2c0d2c1d7c496a
|
F test/tclsqlite.test aa1781808502271feccfd24f9e2c0d2c1d7c496a
|
||||||
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
|
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
|
||||||
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
|
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
|
||||||
F test/tester.tcl fbb53d7a92ab9156cf123a2dd47528a22c649860
|
F test/tester.tcl 3a121e1a03b29376057b3dfff429ad4f373cd0c3
|
||||||
F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7
|
F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7
|
||||||
F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b
|
F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b
|
||||||
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
||||||
@@ -603,7 +603,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P c45d578e4475486dc5df1c1c0b6987d1cef39188
|
P c9ffbfe343b640051161301869698dd9f1f76cb7
|
||||||
R fcf7cc9c66cbbb6fac0990a081db5c0e
|
R e52a0e0f0e545d82edca5fee51f0391a
|
||||||
U drh
|
U drh
|
||||||
Z a83f4b571a6e380574d50c852424d70b
|
Z 3dba639b9a1f25eb1dff3dc290a1617a
|
||||||
|
@@ -1 +1 @@
|
|||||||
c9ffbfe343b640051161301869698dd9f1f76cb7
|
d7e2f0d2d45574d6191c1b191c0daf5260696f27
|
15
src/btree.c
15
src/btree.c
@@ -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.478 2008/07/11 03:38:41 drh Exp $
|
** $Id: btree.c,v 1.479 2008/07/11 16:15:18 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.
|
||||||
@@ -793,7 +793,7 @@ static void freeSpace(MemPage *pPage, int start, int size){
|
|||||||
assert( start>=pPage->hdrOffset+6+(pPage->leaf?0:4) );
|
assert( start>=pPage->hdrOffset+6+(pPage->leaf?0:4) );
|
||||||
assert( (start + size)<=pPage->pBt->usableSize );
|
assert( (start + size)<=pPage->pBt->usableSize );
|
||||||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||||
if( size<4 ) size = 4;
|
assert( size>=0 ); /* Minimum cell size is 4 */
|
||||||
|
|
||||||
#ifdef SQLITE_SECURE_DELETE
|
#ifdef SQLITE_SECURE_DELETE
|
||||||
/* Overwrite deleted information with zeros when the SECURE_DELETE
|
/* Overwrite deleted information with zeros when the SECURE_DELETE
|
||||||
@@ -1177,8 +1177,7 @@ int sqlite3BtreeOpen(
|
|||||||
** If this Btree is a candidate for shared cache, try to find an
|
** If this Btree is a candidate for shared cache, try to find an
|
||||||
** existing BtShared object that we can share with
|
** existing BtShared object that we can share with
|
||||||
*/
|
*/
|
||||||
if( (flags & BTREE_PRIVATE)==0
|
if( isMemdb==0
|
||||||
&& isMemdb==0
|
|
||||||
&& (db->flags & SQLITE_Vtab)==0
|
&& (db->flags & SQLITE_Vtab)==0
|
||||||
&& zFilename && zFilename[0]
|
&& zFilename && zFilename[0]
|
||||||
){
|
){
|
||||||
@@ -1187,9 +1186,7 @@ int sqlite3BtreeOpen(
|
|||||||
char *zFullPathname = sqlite3Malloc(nFullPathname);
|
char *zFullPathname = sqlite3Malloc(nFullPathname);
|
||||||
sqlite3_mutex *mutexShared;
|
sqlite3_mutex *mutexShared;
|
||||||
p->sharable = 1;
|
p->sharable = 1;
|
||||||
if( db ){
|
db->flags |= SQLITE_SharedCache;
|
||||||
db->flags |= SQLITE_SharedCache;
|
|
||||||
}
|
|
||||||
if( !zFullPathname ){
|
if( !zFullPathname ){
|
||||||
sqlite3_free(p);
|
sqlite3_free(p);
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
@@ -1375,10 +1372,10 @@ static int removeFromSharingList(BtShared *pBt){
|
|||||||
sqlite3SharedCacheList = pBt->pNext;
|
sqlite3SharedCacheList = pBt->pNext;
|
||||||
}else{
|
}else{
|
||||||
pList = sqlite3SharedCacheList;
|
pList = sqlite3SharedCacheList;
|
||||||
while( pList && pList->pNext!=pBt ){
|
while( ALWAYS(pList) && pList->pNext!=pBt ){
|
||||||
pList=pList->pNext;
|
pList=pList->pNext;
|
||||||
}
|
}
|
||||||
if( pList ){
|
if( ALWAYS(pList) ){
|
||||||
pList->pNext = pBt->pNext;
|
pList->pNext = pBt->pNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.100 2008/07/10 00:32:42 drh Exp $
|
** @(#) $Id: btree.h,v 1.101 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _BTREE_H_
|
#ifndef _BTREE_H_
|
||||||
#define _BTREE_H_
|
#define _BTREE_H_
|
||||||
@@ -76,11 +76,6 @@ int sqlite3BtreeOpen(
|
|||||||
#define BTREE_READWRITE 16 /* Open for both reading and writing */
|
#define BTREE_READWRITE 16 /* Open for both reading and writing */
|
||||||
#define BTREE_CREATE 32 /* Create the database if it does not exist */
|
#define BTREE_CREATE 32 /* Create the database if it does not exist */
|
||||||
|
|
||||||
/* Additional values for the 4th argument of sqlite3BtreeOpen that
|
|
||||||
** are not associated with PAGER_ values.
|
|
||||||
*/
|
|
||||||
#define BTREE_PRIVATE 64 /* Never share with other connections */
|
|
||||||
|
|
||||||
int sqlite3BtreeClose(Btree*);
|
int sqlite3BtreeClose(Btree*);
|
||||||
int sqlite3BtreeSetCacheSize(Btree*,int);
|
int sqlite3BtreeSetCacheSize(Btree*,int);
|
||||||
int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
|
int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.475 2008/07/10 18:13:42 drh Exp $
|
** $Id: main.c,v 1.476 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -584,8 +584,7 @@ static int sqliteDefaultBusyCallback(
|
|||||||
*/
|
*/
|
||||||
int sqlite3InvokeBusyHandler(BusyHandler *p){
|
int sqlite3InvokeBusyHandler(BusyHandler *p){
|
||||||
int rc;
|
int rc;
|
||||||
failsafe( p==0, 0x912aaf8d, {return 0;})
|
if( NEVER(p==0) || p->xFunc==0 || p->nBusy<0 ) return 0;
|
||||||
if( p->xFunc==0 || p->nBusy<0 ) return 0;
|
|
||||||
rc = p->xFunc(p->pArg, p->nBusy);
|
rc = p->xFunc(p->pArg, p->nBusy);
|
||||||
if( rc==0 ){
|
if( rc==0 ){
|
||||||
p->nBusy = -1;
|
p->nBusy = -1;
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
** the version number) and changes its name to "sqlite3.h" as
|
** the version number) and changes its name to "sqlite3.h" as
|
||||||
** part of the build process.
|
** part of the build process.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqlite.h.in,v 1.367 2008/07/10 18:13:42 drh Exp $
|
** @(#) $Id: sqlite.h.in,v 1.368 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef _SQLITE3_H_
|
||||||
#define _SQLITE3_H_
|
#define _SQLITE3_H_
|
||||||
@@ -6112,7 +6112,6 @@ int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
|
|||||||
#define SQLITE_STATUS_SCRATCH_USED 3
|
#define SQLITE_STATUS_SCRATCH_USED 3
|
||||||
#define SQLITE_STATUS_SCRATCH_OVERFLOW 4
|
#define SQLITE_STATUS_SCRATCH_OVERFLOW 4
|
||||||
#define SQLITE_STATUS_MALLOC_SIZE 5
|
#define SQLITE_STATUS_MALLOC_SIZE 5
|
||||||
#define SQLITE_STATUS_FAILSAFE 6
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.740 2008/07/10 00:32:42 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.741 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@@ -63,24 +63,24 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The failsafe() macro is used to test for error conditions that
|
** The ALWAYS and NEVER macros surround boolean expressions which
|
||||||
** should never occur. This is similar to assert() except that with
|
** are intended to always be true or false, respectively. Such
|
||||||
** failsafe() the application attempts to recover gracefully rather
|
** expressions could be omitted from the code completely. But they
|
||||||
** than abort. If a error condition is detected, a global flag is
|
** are included in a few cases in order to enhance the resilience
|
||||||
** set to the "Id" prior to recovery in order to alert the application
|
** of SQLite to unexpected behavior - to make the code "self-healing"
|
||||||
** to the error condition.
|
** or "ductile" rather than being "brittle" and crashing at the first
|
||||||
|
** hint of unplanned behavior.
|
||||||
**
|
**
|
||||||
** The Id should be a random integer. The idea behind the Id is that
|
** When doing coverage testing ALWAYS and NEVER are hard-coded to
|
||||||
** failsafe() faults in the field can be mapped back to specific failsafe()
|
** be true and false so that the unreachable code then specify will
|
||||||
** macros, even if line numbers and filenames have changed.
|
** not be counted as untested code.
|
||||||
**
|
|
||||||
** The test condition is argument Cond. The recovery action is
|
|
||||||
** argument Action.
|
|
||||||
*/
|
*/
|
||||||
#ifdef SQLITE_COVERAGE_TEST
|
#ifdef SQLITE_COVERAGE_TEST
|
||||||
# define failsafe(Cond,Id,Action)
|
# define ALWAYS(X) (1)
|
||||||
|
# define NEVER(X) (0)
|
||||||
#else
|
#else
|
||||||
# define failsafe(Cond,Id,Action) if( Cond ){ sqlite3Failsafe(Id); Action; }
|
# define ALWAYS(X) (X)
|
||||||
|
# define NEVER(X) (X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1775,7 +1775,6 @@ struct Sqlite3Config {
|
|||||||
int bCoreMutex; /* True to enable core mutexing */
|
int bCoreMutex; /* True to enable core mutexing */
|
||||||
int bFullMutex; /* True to enable full mutexing */
|
int bFullMutex; /* True to enable full mutexing */
|
||||||
int mxStrlen; /* Maximum string length */
|
int mxStrlen; /* Maximum string length */
|
||||||
int iFailsafe; /* Id of failed failsafe() */
|
|
||||||
sqlite3_mem_methods m; /* Low-level memory allocation interface */
|
sqlite3_mem_methods m; /* Low-level memory allocation interface */
|
||||||
sqlite3_mutex_methods mutex; /* Low-level mutex interface */
|
sqlite3_mutex_methods mutex; /* Low-level mutex interface */
|
||||||
void *pHeap; /* Heap storage space */
|
void *pHeap; /* Heap storage space */
|
||||||
@@ -2019,7 +2018,6 @@ void sqlite3RegisterDateTimeFunctions(sqlite3*);
|
|||||||
#endif
|
#endif
|
||||||
int sqlite3SafetyCheckOk(sqlite3*);
|
int sqlite3SafetyCheckOk(sqlite3*);
|
||||||
int sqlite3SafetyCheckSickOrOk(sqlite3*);
|
int sqlite3SafetyCheckSickOrOk(sqlite3*);
|
||||||
void sqlite3Failsafe(int);
|
|
||||||
void sqlite3ChangeCookie(Parse*, int);
|
void sqlite3ChangeCookie(Parse*, int);
|
||||||
void sqlite3MaterializeView(Parse*, Select*, Expr*, int);
|
void sqlite3MaterializeView(Parse*, Select*, Expr*, int);
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** This module implements the sqlite3_status() interface and related
|
** This module implements the sqlite3_status() interface and related
|
||||||
** functionality.
|
** functionality.
|
||||||
**
|
**
|
||||||
** $Id: status.c,v 1.2 2008/07/09 13:28:54 drh Exp $
|
** $Id: status.c,v 1.3 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -73,11 +73,6 @@ void sqlite3StatusSet(int op, int X){
|
|||||||
** then this routine is not threadsafe.
|
** then this routine is not threadsafe.
|
||||||
*/
|
*/
|
||||||
int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
|
int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
|
||||||
if( op==SQLITE_STATUS_FAILSAFE ){
|
|
||||||
*pCurrent = *pHighwater = sqlite3Config.iFailsafe;
|
|
||||||
if( resetFlag ) sqlite3Config.iFailsafe = 0;
|
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
|
||||||
if( op<0 || op>=ArraySize(sqlite3Stat.nowValue) ){
|
if( op<0 || op>=ArraySize(sqlite3Stat.nowValue) ){
|
||||||
return SQLITE_MISUSE;
|
return SQLITE_MISUSE;
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** This file contains code used to implement test interfaces to the
|
** This file contains code used to implement test interfaces to the
|
||||||
** memory allocation subsystem.
|
** memory allocation subsystem.
|
||||||
**
|
**
|
||||||
** $Id: test_malloc.c,v 1.36 2008/07/10 18:13:42 drh Exp $
|
** $Id: test_malloc.c,v 1.37 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
@@ -1058,7 +1058,6 @@ static int test_status(
|
|||||||
{ "SQLITE_STATUS_SCRATCH_USED", SQLITE_STATUS_SCRATCH_USED },
|
{ "SQLITE_STATUS_SCRATCH_USED", SQLITE_STATUS_SCRATCH_USED },
|
||||||
{ "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW },
|
{ "SQLITE_STATUS_SCRATCH_OVERFLOW", SQLITE_STATUS_SCRATCH_OVERFLOW },
|
||||||
{ "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE },
|
{ "SQLITE_STATUS_MALLOC_SIZE", SQLITE_STATUS_MALLOC_SIZE },
|
||||||
{ "SQLITE_STATUS_FAILSAFE", SQLITE_STATUS_FAILSAFE },
|
|
||||||
};
|
};
|
||||||
Tcl_Obj *pResult;
|
Tcl_Obj *pResult;
|
||||||
if( objc!=3 ){
|
if( objc!=3 ){
|
||||||
|
18
src/util.c
18
src/util.c
@@ -14,7 +14,7 @@
|
|||||||
** This file contains functions for allocating memory, comparing
|
** This file contains functions for allocating memory, comparing
|
||||||
** strings, and stuff like that.
|
** strings, and stuff like that.
|
||||||
**
|
**
|
||||||
** $Id: util.c,v 1.236 2008/07/10 00:32:42 drh Exp $
|
** $Id: util.c,v 1.237 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -936,19 +936,3 @@ int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
|
|||||||
magic!=SQLITE_MAGIC_BUSY ) return 0;
|
magic!=SQLITE_MAGIC_BUSY ) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SQLITE_COVERAGE_TEST
|
|
||||||
/*
|
|
||||||
** Report a failsafe() macro failure
|
|
||||||
*/
|
|
||||||
void sqlite3Failsafe(int iCode){
|
|
||||||
sqlite3Config.iFailsafe = iCode;
|
|
||||||
|
|
||||||
/* The following assert is always false. When assert() is enabled,
|
|
||||||
** the following causes a failsafe() failure to work like an assert()
|
|
||||||
** failure. Normal operating mode for SQLite is for assert() to be
|
|
||||||
** disabled, however, so the following is normally a no-op.
|
|
||||||
*/
|
|
||||||
assert( iCode==0 ); /* Always fails if assert() is enabled */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
** to version 2.8.7, all this code was combined into the vdbe.c source file.
|
** to version 2.8.7, all this code was combined into the vdbe.c source file.
|
||||||
** But that file was getting too big so this subroutines were split out.
|
** But that file was getting too big so this subroutines were split out.
|
||||||
**
|
**
|
||||||
** $Id: vdbeaux.c,v 1.395 2008/07/08 22:28:49 shane Exp $
|
** $Id: vdbeaux.c,v 1.396 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1083,11 +1083,12 @@ void sqlite3VdbeFreeCursor(Vdbe *p, Cursor *pCx){
|
|||||||
if( pCx==0 ){
|
if( pCx==0 ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( pCx->pCursor ){
|
|
||||||
sqlite3BtreeCloseCursor(pCx->pCursor);
|
|
||||||
}
|
|
||||||
if( pCx->pBt ){
|
if( pCx->pBt ){
|
||||||
sqlite3BtreeClose(pCx->pBt);
|
sqlite3BtreeClose(pCx->pBt);
|
||||||
|
/* The pCx->pCursor will be close automatically, if it exists, by
|
||||||
|
** the call above. */
|
||||||
|
}else if( pCx->pCursor ){
|
||||||
|
sqlite3BtreeCloseCursor(pCx->pCursor);
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
if( pCx->pVtabCursor ){
|
if( pCx->pVtabCursor ){
|
||||||
|
11
src/where.c
11
src/where.c
@@ -16,7 +16,7 @@
|
|||||||
** so is applicable. Because this module is responsible for selecting
|
** so is applicable. Because this module is responsible for selecting
|
||||||
** indices, you might also think of this module as the "query optimizer".
|
** indices, you might also think of this module as the "query optimizer".
|
||||||
**
|
**
|
||||||
** $Id: where.c,v 1.315 2008/07/09 13:28:54 drh Exp $
|
** $Id: where.c,v 1.316 2008/07/11 16:15:18 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ static WhereTerm *findTerm(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(j=0; pIdx->aiColumn[j]!=iColumn; j++){
|
for(j=0; pIdx->aiColumn[j]!=iColumn; j++){
|
||||||
failsafe( j>=pIdx->nColumn, 0x0128fc98, {return 0;});
|
if( NEVER(j>=pIdx->nColumn) ) return 0;
|
||||||
}
|
}
|
||||||
if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;
|
if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;
|
||||||
}
|
}
|
||||||
@@ -1608,8 +1608,7 @@ static double bestIndex(
|
|||||||
flags |= WHERE_COLUMN_IN;
|
flags |= WHERE_COLUMN_IN;
|
||||||
if( pExpr->pSelect!=0 ){
|
if( pExpr->pSelect!=0 ){
|
||||||
inMultiplier *= 25;
|
inMultiplier *= 25;
|
||||||
}else{
|
}else if( ALWAYS(pExpr->pList) ){
|
||||||
failsafe( pExpr->pList==0, 0x16b91d0f, continue);
|
|
||||||
inMultiplier *= pExpr->pList->nExpr + 1;
|
inMultiplier *= pExpr->pList->nExpr + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1725,9 +1724,9 @@ static double bestIndex(
|
|||||||
*/
|
*/
|
||||||
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
|
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
|
||||||
if( pTerm
|
if( pTerm
|
||||||
|
&& ALWAYS((pTerm->flags & TERM_CODED)==0)
|
||||||
&& (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
|
&& (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
|
||||||
){
|
){
|
||||||
failsafe( (pTerm->flags & TERM_CODED)!=0, 0x641154a4, /* no-op */ );
|
|
||||||
pTerm->flags |= TERM_CODED;
|
pTerm->flags |= TERM_CODED;
|
||||||
if( pTerm->iParent>=0 ){
|
if( pTerm->iParent>=0 ){
|
||||||
WhereTerm *pOther = &pTerm->pWC->a[pTerm->iParent];
|
WhereTerm *pOther = &pTerm->pWC->a[pTerm->iParent];
|
||||||
@@ -1873,7 +1872,7 @@ static int codeAllEqualityTerms(
|
|||||||
int r1;
|
int r1;
|
||||||
int k = pIdx->aiColumn[j];
|
int k = pIdx->aiColumn[j];
|
||||||
pTerm = findTerm(pWC, iCur, k, notReady, pLevel->flags, pIdx);
|
pTerm = findTerm(pWC, iCur, k, notReady, pLevel->flags, pIdx);
|
||||||
failsafe( pTerm==0, 0x7592494c, break );
|
if( NEVER(pTerm==0) ) break;
|
||||||
assert( (pTerm->flags & TERM_CODED)==0 );
|
assert( (pTerm->flags & TERM_CODED)==0 );
|
||||||
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
||||||
if( r1!=regBase+j ){
|
if( r1!=regBase+j ){
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# This file implements some common TCL routines used for regression
|
# This file implements some common TCL routines used for regression
|
||||||
# testing the SQLite library
|
# testing the SQLite library
|
||||||
#
|
#
|
||||||
# $Id: tester.tcl,v 1.130 2008/07/09 16:51:52 drh Exp $
|
# $Id: tester.tcl,v 1.131 2008/07/11 16:15:18 drh Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# What for user input before continuing. This gives an opportunity
|
# What for user input before continuing. This gives an opportunity
|
||||||
@@ -287,16 +287,6 @@ proc finalize_testing {} {
|
|||||||
if {$nErr>0} {
|
if {$nErr>0} {
|
||||||
puts "Failures on these tests: $::failList"
|
puts "Failures on these tests: $::failList"
|
||||||
}
|
}
|
||||||
set failsafe [lindex [sqlite3_status SQLITE_STATUS_FAILSAFE 1] 1]
|
|
||||||
if {$failsafe} {
|
|
||||||
puts "Failsafe error code [format 0x%08x $failsafe]"
|
|
||||||
incr nErr
|
|
||||||
}
|
|
||||||
set fs2 [lindex [sqlite3_status SQLITE_STATUS_FAILSAFE 0] 1]
|
|
||||||
if {$fs2} {
|
|
||||||
puts "Failsafe failed to reset"
|
|
||||||
incr nErr
|
|
||||||
}
|
|
||||||
if {[llength $omitList]>0} {
|
if {[llength $omitList]>0} {
|
||||||
puts "Omitted test cases:"
|
puts "Omitted test cases:"
|
||||||
set prec {}
|
set prec {}
|
||||||
|
Reference in New Issue
Block a user