Improvements to test coverage in the lemon-generated parser and in the

sqlite3_get_table() interface. (CVS 4745)

FossilOrigin-Name: 9f95d79daeb5e7f6fd62f3c896dae4d332121d1c
This commit is contained in:
drh 2008-01-23 12:52:40 +00:00
parent 7e8b848a60
commit 01495b9921
15 changed files with 126 additions and 154 deletions

View File

@ -1,5 +1,5 @@
C Make\ssqlite3SafetyOn()\sand\ssqlite3SafetyOff()\smacros\swhich\sdisappear\swhen\ncompiling\swithout\s-DSQLITE_DEBUG=1.\s(CVS\s4744)
D 2008-01-23T03:03:05
C Improvements\sto\stest\scoverage\sin\sthe\slemon-generated\sparser\sand\sin\sthe\nsqlite3_get_table()\sinterface.\s(CVS\s4745)
D 2008-01-23T12:52:41
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in bc2b5df3e3d0d4b801b824b7ef6dec43812b049b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -82,7 +82,7 @@ F src/alter.c 2a101cb062b82fa29db9b105a1078690aa0a3c11
F src/analyze.c 13d64eeba3f49c3096abba96e38b898018afd504
F src/attach.c 2a0b199467c6c0212fae26a6b51bef132680f881
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/btmutex.c 5d39da37c9d1282f3c6f9967afae6a34ee36b7ff
F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
F src/btree.c a3125bd53a4112f2f259af858ef2eff63e397c9b
F src/btree.h 19dcf5ad23c17b98855da548e9a8e3eb4429d5eb
F src/btreeInt.h 1c5a9da165718ef7de81e35ce9ab5d9ba9283f76
@ -102,7 +102,7 @@ F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
F src/loadext.c d17a0f760d6866aacf5262f97d8efaaad379cdd7
F src/main.c a85079f79c2b47e704ea644773c610f9fd5cdf7d
F src/main.c 2d4b0de4bcc2a976b638a0b72947ad363b763ca2
F src/malloc.c 60e392a4c12c839517f9b0db7b995f825444fb35
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/mem1.c 6d1a11864963d249c67e72ad5f6533b040333880
@ -139,7 +139,7 @@ F src/sqlite.h.in 2a7e3776534bbe6ff2cdc058f3abebe91e7e429f
F src/sqlite3ext.h a93f59cdee3638dc0c9c086f80df743a4e68c3cb
F src/sqliteInt.h 9d87dc3aa23d78567e8f83c99dd991ea88e303fe
F src/sqliteLimit.h ee4430f88f69bf63527967bb35ca52af7b0ccb1e
F src/table.c 1aeb9eab57b4235db86fe15a35dec76fb445a9c4
F src/table.c e97099ce0e442930ed9dbfd95072eccd70ab499a
F src/tclsqlite.c 9923abeffc9b3d7dad58e92b319661521f60debf
F src/test1.c 0040e28115047a50dde02383658f6b25ecbbcb42
F src/test2.c 77b34303883b9d722c65a6879bb0163a400e3789
@ -149,11 +149,11 @@ F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
F src/test6.c f8b34a6ff04937092327798ddf0ab46863535bc5
F src/test7.c acec2256c7c2d279db5a8b5fa1a2a68fcc942c67
F src/test8.c cab3f576353dfef4877c7cc3b0d0e48acc65c37c
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc
F src/test_async.c 5f21392d66869a4c87dc9153e40d0dc0e085261f
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
F src/test_config.c a3ac9faf2e3c032bb0bdb9e3f2fd36a1e17a6cce
F src/test_config.c e7db7a46833d0df98ae6c9a11f70dada1bcca249
F src/test_devsym.c fd8884c2269fb7e0db2c52d21ec59d31a33790ba
F src/test_hexio.c 1a1cd8324d57585ea86b922f609fa1fbaaf9662d
F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
@ -179,7 +179,7 @@ F src/vdbeblob.c 3626867e85b815f60c3056e9a649869cc09dcea4
F src/vdbefifo.c 334c838c8f42d61a94813d136019ee566b5dc2f6
F src/vdbemem.c 79ec9d0d15167baafde2259dddde2a67bd21bcd7
F src/vtab.c dc8947c9c79780b19ee6d6bae4ea624a2a303353
F src/where.c b6c296c5f4a584d837ee1117b31a7e63253aa295
F src/where.c 7ff0ca021cc77086e367ed3b6308fbc6bc9e1a31
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/all.test d12210212bada2bde6d5aeb90969b86c1aa977d2
@ -236,7 +236,7 @@ F test/collate7.test e23677b1fd271505302643a98178952bb65b6f21
F test/collate8.test 7ed2461305ac959886a064dc1e3cf15e155a183f
F test/collate9.test 0867eabc1222ab0bc308fc09a7fb30770334c3cd
F test/collateA.test 84ff3239d530c1a2c784159594b2ae05238e3ff7
F test/colmeta.test 6505c73ab58796afcb7c89ba9f429d573fbc6e53
F test/colmeta.test 087c42997754b8c648819832241daf724f813322
F test/conflict.test bb29b052c60a1f7eb6382be77902061d1f305318
F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
F test/corrupt2.test 572f8df0303d0ce63ddad5c5c9101a83a345ae46
@ -358,7 +358,7 @@ F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51
F test/laststmtchanges.test 18ead86c8a87ade949a1d5658f6dc4bb111d1b02
F test/like.test 2a2cd2d67ea43526b97c001304a6311717331a6a
F test/like.test d2d5efc471db314f662a6f0cfa52c6ec2d4fed8b
F test/limit.test ca61a9fc520f54470edb3a771167fe4b68abc247
F test/loadext.test 1911e7365a6d31d77ba00dd3a8a31b7f2111a670
F test/loadext2.test 95ca7e2cb03fd3e068de97c3a2fe58dbdfd769e1
@ -383,7 +383,7 @@ F test/mallocC.test 9daac0aa8e5b0afa7b0a3fb0cd792f02fe0cc838
F test/mallocD.test 24c1d07a00e605831d0d627b036bd690b2952416
F test/mallocE.test e15333c394d7c330c8372a7cdf7b0f7c16573082
F test/mallocF.test 6f25bc474f2b29954e5fac274d0e6ed9d86efea5
F test/mallocG.test ac896f96098a30ed0dcc001b6f9243770a463081
F test/mallocG.test 5d88decca0444424d7c8d8e156ed1cdf2dfc67d0
F test/malloc_common.tcl 5c5f7ee985c9ef3480f441efb6329aeefbf9380c
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
@ -395,9 +395,9 @@ F test/misc1.test 1b89c02c4a33b49dee4cd1d20d161aaaba719075
F test/misc2.test 1ee89298de9c16b61454658b24999c403e86afe4
F test/misc3.test aea079f4c3d93e9962186f45c0ff0954310e6b11
F test/misc4.test 91e8ed25c092c2bb4e0bb01864631e2930f8d7de
F test/misc5.test b0b4b7e0dd5d40335c8e849e5738d11a40bddc7c
F test/misc5.test c1bc7b8cbc6694dccfc4c0b03c00c8f2dc55c46b
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test b7f829bc371981503de5229683c078e793c39c96
F test/misc7.test 3ec53989ddfa30f0ef68757dd04726c9896376c0
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
F test/null.test a8b09b8ed87852742343b33441a9240022108993
@ -450,7 +450,7 @@ F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4
F test/substr.test 4be572ac017143e59b4058dc75c91a0d0dc6d4e0
F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3
F test/table.test 13b1c2e2fb4727b35ee1fb7641fc469214fd2455
F test/tableapi.test 92651a95c23cf955e92407928e640536402fa3cc
F test/tableapi.test f6d07b9d63c3b0a5d09166d9bbd741e52d4ef309
F test/tclsqlite.test 3fac87cb1059c46b8fa8a60b553f4f1adb0fb6d9
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
F test/tester.tcl 6a6600646341b910f2fbfd02db1ef0274479366c
@ -538,7 +538,7 @@ F test/zeroblob.test 7d1854ea79d048e023e5f2e38106a7e99a17435c
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/lemon.c 5d1731de7eb31238e42ff424c0c78efb4a7be635
F tool/lempar.c 2dafd3da7fba7ccecc3af58fb512f0cbfb8058a4
F tool/lempar.c ac41fdc42337c0831fa4c7c848801dccb3fbdd4d
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
@ -614,7 +614,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P c82033faf8bdb83ce43f0dd1611408e7796d53de
R a7bab11a5203e06d1125cf46686f1cb9
P 5375ad6b4b652f388469b0ce4e8e78b3f49169bd
R cb7fa5e7c3a95c6765c29d29026204b1
U drh
Z 6af45d96f0c2b29ef6c64bd43b03c5c9
Z cad27d1b994b4367a16598d68d423c30

View File

@ -1 +1 @@
5375ad6b4b652f388469b0ce4e8e78b3f49169bd
9f95d79daeb5e7f6fd62f3c896dae4d332121d1c

View File

@ -10,7 +10,7 @@
**
*************************************************************************
**
** $Id: btmutex.c,v 1.8 2007/12/07 18:55:28 drh Exp $
** $Id: btmutex.c,v 1.9 2008/01/23 12:52:41 drh Exp $
**
** This file contains code used to implement mutexes on Btree objects.
** This code really belongs in btree.c. But btree.c is getting too
@ -61,6 +61,7 @@ void sqlite3BtreeEnter(Btree *p){
p->wantToLock++;
if( p->locked ) return;
#ifndef SQLITE_MUTEX_NOOP
/* In most cases, we should be able to acquire the lock we
** want without having to go throught the ascending lock
** procedure that follows. Just be sure not to block.
@ -92,6 +93,7 @@ void sqlite3BtreeEnter(Btree *p){
pLater->locked = 1;
}
}
#endif /* SQLITE_MUTEX_NOOP */
}
/*

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.413 2008/01/23 03:03:05 drh Exp $
** $Id: main.c,v 1.414 2008/01/23 12:52:41 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -374,9 +374,6 @@ int sqlite3_busy_handler(
int (*xBusy)(void*,int),
void *pArg
){
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
db->busyHandler.xFunc = xBusy;
db->busyHandler.pArg = pArg;
@ -419,9 +416,6 @@ void sqlite3_progress_handler(
** specified number of milliseconds before returning 0.
*/
int sqlite3_busy_timeout(sqlite3 *db, int ms){
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
if( ms>0 ){
db->busyTimeout = ms;
sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
@ -461,9 +455,6 @@ int sqlite3CreateFunc(
int nName;
assert( sqlite3_mutex_held(db->mutex) );
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
if( zFunctionName==0 ||
(xFunc && (xFinal || xStep)) ||
(!xFunc && (xFinal && !xStep)) ||
@ -849,12 +840,12 @@ const void *sqlite3_errmsg16(sqlite3 *db){
** passed to this function, we assume a malloc() failed during sqlite3_open().
*/
int sqlite3_errcode(sqlite3 *db){
if( !db || db->mallocFailed ){
return SQLITE_NOMEM;
}
if( !sqlite3SafetyCheckSickOrOk(db) ){
return SQLITE_MISUSE;
}
if( !db || db->mallocFailed ){
return SQLITE_NOMEM;
}
return db->errCode & db->errMask;
}
@ -873,9 +864,6 @@ static int createCollation(
CollSeq *pColl;
int enc2;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
assert( sqlite3_mutex_held(db->mutex) );
/* If SQLITE_UTF16 is specified as the encoding type, transform this
@ -1217,7 +1205,7 @@ int sqlite3_create_collation16(
int(*xCompare)(void*,int,const void*,int,const void*)
){
int rc = SQLITE_OK;
char *zName8;
char *zName8;
sqlite3_mutex_enter(db->mutex);
assert( !db->mallocFailed );
zName8 = sqlite3Utf16to8(db, zName, -1);
@ -1240,9 +1228,6 @@ int sqlite3_collation_needed(
void *pCollNeededArg,
void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
){
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
db->xCollNeeded = xCollNeeded;
db->xCollNeeded16 = 0;
@ -1261,9 +1246,6 @@ int sqlite3_collation_needed16(
void *pCollNeededArg,
void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
){
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
db->xCollNeeded = 0;
db->xCollNeeded16 = xCollNeeded16;
@ -1345,9 +1327,7 @@ int sqlite3_table_column_metadata(
int autoinc = 0;
/* Ensure the database schema has been loaded */
if( !sqlite3SafetyCheckOk(db) || sqlite3SafetyOn(db) ){
return SQLITE_MISUSE;
}
(void)sqlite3SafetyOn(db);
sqlite3_mutex_enter(db->mutex);
rc = sqlite3Init(db, &zErrMsg);
if( SQLITE_OK!=rc ){
@ -1405,9 +1385,7 @@ int sqlite3_table_column_metadata(
}
error_out:
if( sqlite3SafetyOff(db) ){
rc = SQLITE_MISUSE;
}
(void)sqlite3SafetyOff(db);
/* Whether the function call succeeded or failed, set the output parameters
** to whatever their local counterparts contain. If an error did occur,

View File

@ -75,12 +75,14 @@ static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
}else{
z = sqlite3_mprintf("%s", colv[i]);
}
if( z==0 ) goto malloc_failed;
p->azResult[p->nData++] = z;
}
}else if( p->nColumn!=nCol ){
sqlite3SetString(&p->zErrMsg,
"sqlite3_get_table() called with two or more incompatible queries",
(char*)0);
sqlite3_free(p->zErrMsg);
p->zErrMsg = sqlite3_mprintf(
"sqlite3_get_table() called with two or more incompatible queries"
);
p->rc = SQLITE_ERROR;
return 1;
}
@ -139,15 +141,13 @@ int sqlite3_get_table(
res.nData = 1;
res.nAlloc = 20;
res.rc = SQLITE_OK;
res.azResult = sqlite3_malloc( sizeof(char*)*res.nAlloc );
if( res.azResult==0 ) return SQLITE_NOMEM;
res.azResult = sqlite3_malloc(sizeof(char*)*res.nAlloc );
if( res.azResult==0 ){
db->errCode = SQLITE_NOMEM;
return SQLITE_NOMEM;
}
res.azResult[0] = 0;
rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
#ifndef NDEBUG
sqlite3_mutex_enter(db->mutex);
assert((rc&db->errMask)==rc && (res.rc&db->errMask)==res.rc);
sqlite3_mutex_leave(db->mutex);
#endif
if( res.azResult ){
assert( sizeof(res.azResult[0])>= sizeof(res.nData) );
res.azResult[0] = (char*)res.nData;
@ -161,9 +161,7 @@ int sqlite3_get_table(
}
sqlite3_free(res.zErrMsg);
}
sqlite3_mutex_enter(db->mutex);
db->errCode = res.rc;
sqlite3_mutex_leave(db->mutex);
db->errCode = res.rc; /* Assume 32-bit assignment is atomic */
return res.rc;
}
sqlite3_free(res.zErrMsg);
@ -176,6 +174,7 @@ int sqlite3_get_table(
azNew = sqlite3_realloc( res.azResult, sizeof(char*)*(res.nData+1) );
if( azNew==0 ){
sqlite3_free_table(&res.azResult[1]);
db->errCode = SQLITE_NOMEM;
return SQLITE_NOMEM;
}
res.nAlloc = res.nData+1;

View File

@ -14,7 +14,7 @@
** for completeness. Test code is written in C for these cases
** as there is not much point in binding to Tcl.
**
** $Id: test9.c,v 1.4 2007/08/21 10:44:16 drh Exp $
** $Id: test9.c,v 1.5 2008/01/23 12:52:41 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@ -131,41 +131,22 @@ static int c_misuse_test(
}
sqlite3_close(db);
#ifndef SQLITE_OMIT_UTF16
rc = sqlite3_collation_needed16(db, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_collation_needed16";
goto error_out;
}
#endif
rc = sqlite3_collation_needed(db, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_collation_needed";
goto error_out;
}
rc = sqlite3_create_collation(db, 0, 0, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_create_collation";
goto error_out;
}
rc = sqlite3_create_function(db, 0, 0, 0, 0, 0, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_create_function";
goto error_out;
}
rc = sqlite3_busy_handler(db, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_busy_handler";
goto error_out;
}
rc = sqlite3_errcode(db);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_busy_handler";
zErrFunction = "sqlite3_errcode";
goto error_out;
}
rc = sqlite3_prepare(db, 0, 0, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_prepare";
goto error_out;
}
rc = sqlite3_prepare_v2(db, 0, 0, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_prepare_v2";
goto error_out;
}
@ -175,6 +156,11 @@ static int c_misuse_test(
zErrFunction = "sqlite3_prepare16";
goto error_out;
}
rc = sqlite3_prepare16_v2(db, 0, 0, 0, 0);
if( rc!=SQLITE_MISUSE ){
zErrFunction = "sqlite3_prepare16_v2";
goto error_out;
}
#endif
return TCL_OK;

View File

@ -16,7 +16,7 @@
** The focus of this file is providing the TCL testing layer
** access to compile-time constants.
**
** $Id: test_config.c,v 1.18 2008/01/22 23:37:10 drh Exp $
** $Id: test_config.c,v 1.19 2008/01/23 12:52:41 drh Exp $
*/
#include "sqliteLimit.h"
@ -44,6 +44,8 @@ int sqlite3MAX_LIKE_PATTERN_LENGTH = SQLITE_MAX_LIKE_PATTERN_LENGTH;
** procedures use this to determine when tests should be omitted.
*/
static void set_options(Tcl_Interp *interp){
int rc = 0;
#ifdef SQLITE_32BIT_ROWID
Tcl_SetVar2(interp, "sqlite_options", "rowid32", "1", TCL_GLOBAL_ONLY);
#else
@ -366,12 +368,13 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "tclvar", "1", TCL_GLOBAL_ONLY);
#endif
rc = sqlite3_threadsafe();
#if SQLITE_THREADSAFE
Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "1", TCL_GLOBAL_ONLY);
assert( sqlite3_threadsafe() );
assert( rc );
#else
Tcl_SetVar2(interp, "sqlite_options", "threadsafe", "0", TCL_GLOBAL_ONLY);
assert( !sqlite3_threadsafe() );
assert( !rc );
#endif
#ifdef SQLITE_OMIT_TRACE

View File

@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.285 2008/01/23 03:03:05 drh Exp $
** $Id: where.c,v 1.286 2008/01/23 12:52:41 drh Exp $
*/
#include "sqliteInt.h"
@ -540,11 +540,9 @@ static int isLikeOrGlob(
return 0;
}
pColl = pLeft->pColl;
assert( pColl!=0 || pLeft->iColumn==-1 );
if( pColl==0 ){
/* TODO: Coverage testing doesn't get this case. Is it actually possible
** for an expression of type TK_COLUMN to not have an assigned collation
** sequence at this point?
*/
/* No collation is defined for the ROWID. Use the default. */
pColl = db->pDfltColl;
}
if( (pColl->type!=SQLITE_COLL_BINARY || noCase) &&
@ -1859,13 +1857,7 @@ static void whereInfoFree(WhereInfo *pWInfo){
for(i=0; i<pWInfo->nLevel; i++){
sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;
if( pInfo ){
if( pInfo->needToFreeIdxStr ){
/* Coverage: Don't think this can be reached. By the time this
** function is called, the index-strings have been passed
** to the vdbe layer for deletion.
*/
sqlite3_free(pInfo->idxStr);
}
assert( pInfo->needToFreeIdxStr==0 );
sqlite3_free(pInfo);
}
}

View File

@ -12,7 +12,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is the sqlite3_table_column_metadata() API.
#
# $Id: colmeta.test,v 1.3 2006/02/10 13:33:31 danielk1977 Exp $
# $Id: colmeta.test,v 1.4 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -91,13 +91,4 @@ foreach {tn params results} $tests {
} $results
}
do_test colmeta-misuse.1 {
db close
set rc [catch {
sqlite3_table_column_metadata $::DB a b c
} msg]
list $rc $msg
} {1 {library routine called out of sequence}}
finish_test

View File

@ -13,7 +13,7 @@
# in particular the optimizations that occur to help those operators
# run faster.
#
# $Id: like.test,v 1.7 2007/09/12 17:01:45 danielk1977 Exp $
# $Id: like.test,v 1.8 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -397,4 +397,10 @@ do_test like-6.1 {
}
} {'abc 'ax}
do_test like-7.1 {
execsql {
SELECT * FROM t1 WHERE rowid GLOB '1*';
}
} {a}
finish_test

View File

@ -11,7 +11,7 @@
#
# This test script checks malloc failures in various obscure operations.
#
# $Id: mallocG.test,v 1.1 2008/01/22 01:48:09 drh Exp $
# $Id: mallocG.test,v 1.2 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -39,4 +39,18 @@ do_malloc_test mallocG-2 -sqlprep {
SELECT y FROM t1 WHERE x IN t2;
}
do_malloc_test mallocG-3 -sqlprep {
CREATE TABLE t1(x UNIQUE);
INSERT INTO t1 VALUES ('hello');
INSERT INTO t1 VALUES ('out there');
} -sqlbody {
SELECT * FROM t1
WHERE x BETWEEN 'a' AND 'z'
AND x BETWEEN 'c' AND 'w'
AND x BETWEEN 'e' AND 'u'
AND x BETWEEN 'g' AND 'r'
AND x BETWEEN 'i' AND 'q'
AND x BETWEEN 'i' AND 'm'
}
finish_test

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc5.test,v 1.19 2007/12/13 07:58:51 danielk1977 Exp $
# $Id: misc5.test,v 1.20 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -581,15 +581,6 @@ do_test misc5-7.1 {
catchsql $sql
} {1 {parser stack overflow}}
# Check the MISUSE return from sqlitee3_busy_timeout
#
do_test misc5-8.1-misuse {
set DB [sqlite3_connection_pointer db]
db close
sqlite3_busy_timeout $DB 1000
} SQLITE_MISUSE
sqlite3 db test.db
# Ticket #1911
#
ifcapable compound {

View File

@ -10,14 +10,14 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: misc7.test,v 1.17 2007/12/13 21:54:11 drh Exp $
# $Id: misc7.test,v 1.18 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
#do_test misc7-1 {
# c_misuse_test
#} {}
do_test misc7-1-misuse {
c_misuse_test
} {}
do_test misc7-2 {
c_realloc_test

View File

@ -12,7 +12,7 @@
# focus of this file is testing the sqlite_exec_printf() and
# sqlite_get_table_printf() APIs.
#
# $Id: tableapi.test,v 1.13 2007/09/12 17:01:45 danielk1977 Exp $
# $Id: tableapi.test,v 1.14 2008/01/23 12:52:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -61,6 +61,11 @@ do_test tableapi-2.3.2 {
SELECT * FROM xyz WHERE a>47 ORDER BY a
} {}
} {0 3 2 a b 48 (48) 49 (49) 50 (50)}
do_test tableapi-2.3.3 {
sqlite3_get_table_printf $::dbx {
SELECT * FROM xyz WHERE a>47 ORDER BY a; invalid
} {}
} {1 {near "invalid": syntax error}}
do_test tableapi-2.4 {
set manyquote ''''''''
append manyquote $manyquote
@ -212,6 +217,20 @@ ifcapable schema_pragmas {
} {0 1 1 user_version 0}
}
ifcapable memdebug {
source $testdir/malloc_common.tcl
do_malloc_test tableapi-7 -sqlprep {
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(3,4);
INSERT INTO t1 SELECT a+4, b+4 FROM t1;
INSERT INTO t1 SELECT a+8, b+8 FROM t1;
} -tclbody {
set r [sqlite3_get_table_printf db {SELECT rowid, a, b FROM t1} {}]
if {[llength $r]<26} {error "out of memory"}
}
}
do_test tableapi-99.0 {
sqlite3_close $::dbx
} {SQLITE_OK}

View File

@ -349,9 +349,7 @@ static int yy_find_shift_action(
if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
return yy_default[stateno];
}
if( iLookAhead==YYNOCODE ){
return YY_NO_ACTION;
}
assert( iLookAhead!=YYNOCODE );
i += iLookAhead;
if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
if( iLookAhead>0 ){
@ -402,21 +400,14 @@ static int yy_find_reduce_action(
YYCODETYPE iLookAhead /* The look-ahead token */
){
int i;
/* int stateno = pParser->yystack[pParser->yyidx].stateno; */
if( stateno>YY_REDUCE_MAX ||
(i = yy_reduce_ofst[stateno])==YY_REDUCE_USE_DFLT ){
return yy_default[stateno];
}
if( iLookAhead==YYNOCODE ){
return YY_NO_ACTION;
}
assert( stateno<=YY_REDUCE_MAX );
i = yy_reduce_ofst[stateno];
assert( i!=YY_REDUCE_USE_DFLT );
assert( iLookAhead!=YYNOCODE );
i += iLookAhead;
if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
return yy_default[stateno];
}else{
return yy_action[i];
}
assert( i>=0 && i<YY_SZ_ACTTAB );
assert( yy_lookahead[i]==iLookAhead );
return yy_action[i];
}
/*