Update tests to work even if some features of the library are disabled. (CVS 2050)

FossilOrigin-Name: b11fc9b3f3a2711f98e7e45724aa1d30081197f3
This commit is contained in:
drh 2004-11-03 16:27:01 +00:00
parent a71aa00102
commit 6bf895708c
21 changed files with 303 additions and 213 deletions

View File

@ -1,5 +1,5 @@
C More\swork\son\soptionally\sremoving\sunused\sfeatures\sat\scompile-time.\s(CVS\s2049)
D 2004-11-03T13:59:05
C Update\stests\sto\swork\seven\sif\ssome\sfeatures\sof\sthe\slibrary\sare\sdisabled.\s(CVS\s2050)
D 2004-11-03T16:27:01
F Makefile.in c4d2416860f472a1e3393714d0372074197565df
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@ -64,7 +64,7 @@ F src/sqlite.h.in 4f97b5907acfd2a5068cb0cec9d5178816734db7
F src/sqliteInt.h 84d5ca7b02793697641a74fb125fcee3995ea2ff
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c 0302e3f42f015d132d1291f3388c06e86c24a008
F src/test1.c cc5bc94006d23584a966c12b0b9fa1db0d94af76
F src/test1.c df1d1ca2c40cafefb9a29860f072c4d0fee1a7b5
F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
F src/test3.c f423597e220b3d446a65c9cc0c49cb4eb00c0215
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
@ -75,7 +75,7 @@ F src/update.c ee15b7ba712c2292802eba2d465f039b5deada39
F src/utf.c f4f83acd73389090e32d6589d307fc55d794c7ed
F src/util.c 1126ae62ee772feaa64697e4b67244fbde68228a
F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60
F src/vdbe.c c68b1e2b935a83ce94c34689b3f9cd80e2e7e5ce
F src/vdbe.c a156e1a2f324e5e11d82af3fbbf41df7a174c860
F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
F src/vdbeInt.h 6017100adff362b8dfa37a69e3f1431f084bfa5b
F src/vdbeapi.c 3965bf4678ae32c05f73550c1b5be3268f9f3006
@ -90,7 +90,7 @@ F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21
F test/autovacuum.test 832bcbb0086b7a1a5af24f32399e02304f0056d4
F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bind.test a8682ba41433b93bb36a4213a43f282ca9aec5a9
F test/bind.test fa74f98417cd313f28272acff832a8a7d04a0916
F test/blob.test fc41fe95bdc10da51f0dee73ce86e75ce1d6eb9d
F test/btree.test ac0e3327d09ca3daace57aefb7423d1766d2bcfd
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
@ -98,13 +98,13 @@ F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
F test/btree7.test 429b96cfef5b51a7d512cfb4b5b3e453384af293
F test/capi2.test 53e3f399074d5654f26d55b32ccaca7b5b619933
F test/capi2.test 1ec97bf8896185aec2366c7d07b01edef6ae4b7e
F test/capi3.test 9258ca75fc98d89477015dcd70aa3d2757b142b8
F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036
F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50
F test/collate4.test 4a7902b7560686af11d6cace717d876c6937b7ef
F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b
F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675
F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
@ -119,12 +119,12 @@ F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
F test/enc2.test 7a60971a62748be6b607b4b4380eb4c5e151a6ec
F test/enc3.test a96f4a7c44bac4d63bdc4ff422b8049912083998
F test/expr.test 91358521f8ec41cd0fd1c5370c93104265f1fefc
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
F test/index.test 31ed90af028d1ec9a3a8a4f0d7021717ba05dd16
F test/insert.test ebbab63db4ad69395a058514bccb3cdb0a029d48
F test/index.test 83f5c232948801da2d9b7c603362d8e0313485bc
F test/insert.test c571223b499961d843ce0ab4709c87fa60ab2425
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
F test/interrupt.test 6b6b8b86cdeb66d5488bd1db74b4bb3c46e4f565
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
@ -139,14 +139,14 @@ F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35
F test/lock.test 7cb9395919a0986ee4dd08bd49d34df93c8fc4fe
F test/lock2.test 2213590d442147d09fd2334c905a755586c1c398
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/main.test 1430a4b5bd3a6d5e0294966b742d80a551f87211
F test/main.test add6cd4fc1264becd3d195431073f202738af317
F test/malloc.test 769b240d89a7ef3320d88919fdb6765f9395a51f
F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027
F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29
F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6
F test/misc1.test 1a20ea722dff15155e93948dc4ac3e8d80fec386
F test/misc2.test 703734f5817215ca54e364833b3bf5ff36fcc21e
F test/misc3.test 57c373aed45acdf45f8f78ea914ef8855841e6b7
F test/misc3.test db48619711950a1098b9547a8091cbb440b22e54
F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622
F test/misuse.test fcd9e7cec6ecccc34822584aec6b4e31f13629e1
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
@ -154,8 +154,8 @@ F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
F test/pager.test 394455707a079804e8a4e431d12edce831a065f0
F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377
F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b
F test/pagesize.test f4b97dc161c99f9712ffa8ebe6c0eb62c2209ee6
F test/pragma.test 5f5c82ccc2da54e1fb48507841606c7370f70e27
F test/pagesize.test 86e14e54b608c00ecf86d14504ad8fed1e4e0064
F test/pragma.test ed8156b5ef3a82ff7be6bd814b3715079ea5a6b0
F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x
F test/quick.test 2dca186ebd5c418a7699944ba3b5e437d765eddd
@ -167,13 +167,13 @@ F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2
F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5
F test/select6.test 7a4c572ada0c2f969cecacd76f1f5c1533a22bbb
F test/select6.test 4ce9fa563662d5b2f5a8ff57e4d8b2f5cd186d38
F test/select7.test c71c822a82c80bbd55558b4b69d35442dfe22ffd
F test/sort.test c97c1a3289337b1dc349ac8a59e0780d2dcfd90b
F test/subselect.test 50f98723f00e97b1839d36410ee63597ca82d775
F test/table.test fd9a0f4992230e4ca89cd37ae3191a12750df1d0
F test/table.test 109155b5a9aa6c11411c0351181bb6f0f2269d87
F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede
F test/tclsqlite.test 1288e6278e094c58ce650d7cbf3c4f39317d9a34
F test/tclsqlite.test 5e262df81a638a058536fb6d6666f316843ac7b2
F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c
F test/tester.tcl 7ef4fb786e64de47052f3a41e23e863e2b1d6dfb
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
@ -186,22 +186,22 @@ F test/trigger2.test fec8f9091ff1248eafb5a33690ad4ff7615f5215
F test/trigger3.test f1c0cc1365f00b21a8cd41c189edca139c2d6cc6
F test/trigger4.test ce5c97aba6a8a11be5820e694659438c3e982ada
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
F test/types.test ccb0a435851486a046ab5c2c743d1c75b4a22171
F test/types.test 9fa078d90ade052344a02e03a41b5df23bd429f1
F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
F test/vacuum.test 98831051cff8e6084f22785c79bdb10080c42dde
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test ca5c296989d3045f121be9a67588ff88c64874a8
F test/where.test 40dcffcb77ad0a00960cef2b5b1212c77fd02199
F test/view.test 2ec8fd4f3809243ad12667932071d536d1ba6850
F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 250b30bcf3f1f422a2cad24b1597314777058a4b
F tool/lempar.c 1e61d2b6cb9d8affa264a13336bc0c088498caa4
F tool/memleak.awk b744b6109566206c746d826f6ecdba34662216bc
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/memleak3.tcl 336eb50b0849dbf99b1d5462d9c37291b01b2b43
F tool/mkkeywordhash.c f1cb22f47cc6c60d50ac4af19a55c0e8757ac92c
F tool/mkkeywordhash.c b651bd7f7e0b5efea1f9aea3957d5ca4e2067d56
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P bec6a65acaa8bfd8fe2cb475ba2e992a1993e4e7
R 6e0d3930c320ce3bcc70ab4dd9b4be5a
P a82980fd70285820c64b42393ef85a9e21addc5d
R 8b665ecae63deee85dcecde69c7e3c11
U drh
Z 1a8d22166b9da77be53ea3527cb5f275
Z 748c6cf073ccedb84a7443f14a915c73

View File

@ -1 +1 @@
a82980fd70285820c64b42393ef85a9e21addc5d
b11fc9b3f3a2711f98e7e45724aa1d30081197f3

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.106 2004/10/31 02:22:49 drh Exp $
** $Id: test1.c,v 1.107 2004/11/03 16:27:01 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@ -2567,6 +2567,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3_search_count;
extern int sqlite3_interrupt_count;
extern int sqlite3_open_file_count;
extern int sqlite3_sort_count;
extern int sqlite3_current_time;
static struct {
char *zName;
@ -2669,6 +2670,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
}
Tcl_LinkVar(interp, "sqlite_search_count",
(char*)&sqlite3_search_count, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_sort_count",
(char*)&sqlite3_sort_count, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_interrupt_count",
(char*)&sqlite3_interrupt_count, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_open_file_count",

View File

@ -43,7 +43,7 @@
** 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.421 2004/11/03 13:59:06 drh Exp $
** $Id: vdbe.c,v 1.422 2004/11/03 16:27:01 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -69,6 +69,15 @@ int sqlite3_search_count = 0;
*/
int sqlite3_interrupt_count = 0;
/*
** The next global variable is incremented each type the OP_Sort opcode
** is executed. The test procedures use this information to make sure that
** sorting is occurring or not occuring at appropriate times. This variable
** has no function other than to help verify the correct operation of the
** library.
*/
int sqlite3_sort_count = 0;
/*
** Release the memory associated with the given stack level. This
** leaves the Mem.flags field in an inconsistent state.
@ -3951,6 +3960,7 @@ case OP_Sort: {
KeyInfo *pKeyInfo = (KeyInfo*)pOp->p3;
Sorter *pElem;
Sorter *apSorter[NSORT];
sqlite3_sort_count++;
pKeyInfo->enc = p->db->enc;
for(i=0; i<NSORT; i++){
apSorter[i] = 0;

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the sqlite_bind API.
#
# $Id: bind.test,v 1.20 2004/09/24 12:48:13 drh Exp $
# $Id: bind.test,v 1.21 2004/11/03 16:27:02 drh Exp $
#
set testdir [file dirname $argv0]
@ -96,33 +96,54 @@ do_test bind-1.99 {
sqlite3_finalize $VM
} SQLITE_OK
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TAIL]
set TAIL
} {}
# Prepare the statement in different ways depending on whether or not
# the $var processing is compiled into the library.
#
ifcapable {tclvar} {
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TX]
set TX
} {}
set v1 {$one}
set v2 {$::two}
set v3 {${x}}
}
ifcapable {!tclvar} {
do_test bind-2.1 {
execsql {
DELETE FROM t1;
}
set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:one,:two,:_)} -1 TX]
set TX
} {}
set v1 {:one}
set v2 {:two}
set v3 {:_}
}
do_test bind-2.1.1 {
sqlite3_bind_parameter_count $VM
} 3
do_test bind-2.1.2 {
sqlite3_bind_parameter_name $VM 1
} {$one}
} $v1
do_test bind-2.1.3 {
sqlite3_bind_parameter_name $VM 2
} {$::two}
} $v2
do_test bind-2.1.4 {
sqlite3_bind_parameter_name $VM 3
} {${x}}
} $v3
do_test bind-2.1.5 {
sqlite3_bind_parameter_index $VM {$one}
sqlite3_bind_parameter_index $VM $v1
} 1
do_test bind-2.1.6 {
sqlite3_bind_parameter_index $VM {$::two}
sqlite3_bind_parameter_index $VM $v2
} 2
do_test bind-2.1.7 {
sqlite3_bind_parameter_index $VM {${x}}
sqlite3_bind_parameter_index $VM $v3
} 3
do_test bind-2.1.8 {
sqlite3_bind_parameter_index $VM {:hi}
@ -346,33 +367,50 @@ do_test bind-9.7 {
execsql {SELECT * FROM t2}
} {1 999 1000 1001 {} {}}
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,$abc,:abc,$ab,$abc,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
ifcapable {tclvar} {
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,$abc,:abc,$ab,$abc,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
set v1 {$abc}
set v2 {$ab}
}
ifcapable {!tclvar} {
do_test bind-10.1 {
catch {sqlite3_finalize $VM}
set VM [
sqlite3_prepare $DB {
INSERT INTO t2(a,b,c,d,e,f) VALUES(:abc,:xyz,:abc,:xy,:xyz,:abc)
} -1 TAIL
]
sqlite3_bind_parameter_count $VM
} 3
set v1 {:xyz}
set v2 {:xy}
}
do_test bind-10.2 {
sqlite3_bind_parameter_index $VM :abc
} 1
do_test bind-10.3 {
sqlite3_bind_parameter_index $VM {$abc}
sqlite3_bind_parameter_index $VM $v1
} 2
do_test bind-10.4 {
sqlite3_bind_parameter_index $VM {$ab}
sqlite3_bind_parameter_index $VM $v2
} 3
do_test bind-10.5 {
sqlite3_bind_parameter_name $VM 1
} :abc
do_test bind-10.6 {
sqlite3_bind_parameter_name $VM 2
} {$abc}
} $v1
do_test bind-10.7 {
sqlite3_bind_parameter_name $VM 3
} {$ab}
} $v2
do_test bind-10.8 {
sqlite3_bind_int $VM 1 1
sqlite3_bind_int $VM 2 2

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi2.test,v 1.19 2004/09/02 14:57:09 drh Exp $
# $Id: capi2.test,v 1.20 2004/11/03 16:27:02 drh Exp $
#
set testdir [file dirname $argv0]
@ -594,10 +594,12 @@ do_test capi2-7.11a {
execsql {SELECT count(*) FROM t1}
} {4}
do_test capi2-7.12 {
set x [stepsql $DB {EXPLAIN SELECT * FROM t1}]
lindex $x 0
} {0}
ifcapable {explain} {
do_test capi2-7.12 {
set x [stepsql $DB {EXPLAIN SELECT * FROM t1}]
lindex $x 0
} {0}
}
# Ticket #261 - make sure we can finalize before the end of a query.
#

View File

@ -12,7 +12,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is page cache subsystem.
#
# $Id: collate4.test,v 1.3 2004/07/18 21:33:02 drh Exp $
# $Id: collate4.test,v 1.4 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -35,9 +35,9 @@ proc count sql {
# opcode it appends "sort"
#
proc cksort {sql} {
set ::sqlite_sort_count 0
set data [execsql $sql]
set prog [execsql "EXPLAIN $sql"]
if {[regexp Sort $prog]} {set x sort} {set x nosort}
if {$::sqlite_sort_count} {set x sort} {set x nosort}
lappend data $x
return $data
}

View File

@ -16,6 +16,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable {!foreignkey} {
finish_test
return
}
# Create a table and some data to work with.
#
do_test fkey1-1.0 {

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement.
#
# $Id: index.test,v 1.32 2004/08/20 18:34:20 drh Exp $
# $Id: index.test,v 1.33 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -239,7 +239,9 @@ do_test index-8.1 {
#
do_test index-9.1 {
execsql {CREATE TABLE tab1(a int)}
execsql {EXPLAIN CREATE INDEX idx1 ON tab1(a)}
ifcapable {explain} {
execsql {EXPLAIN CREATE INDEX idx1 ON tab1(a)}
}
execsql {SELECT name FROM sqlite_master WHERE tbl_name='tab1'}
} {tab1}
do_test index-9.2 {

View File

@ -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.18 2004/06/19 00:16:31 drh Exp $
# $Id: insert.test,v 1.19 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -222,13 +222,15 @@ do_test insert-5.2 {
SELECT * FROM t4;
}
} {1 2}
do_test insert-5.3 {
# verify that a temporary table is used to copy t4 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
}]
expr {[lsearch $x OpenTemp]>0}
} {1}
ifcapable {explain} {
do_test insert-5.3 {
# verify that a temporary table is used to copy t4 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
}]
expr {[lsearch $x OpenTemp]>0}
} {1}
}
do_test insert-5.4 {
# Verify that table "test1" begins on page 3. This should be the same
@ -254,13 +256,15 @@ do_test insert-5.6 {
SELECT * FROM t4
}
} {1 2 8}
do_test insert-5.7 {
# verify that no temporary table is used to copy test1 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
}]
expr {[lsearch $x OpenTemp]>0}
} {0}
ifcapable {explain} {
do_test insert-5.7 {
# verify that no temporary table is used to copy test1 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
}]
expr {[lsearch $x OpenTemp]>0}
} {0}
}
# Ticket #334: REPLACE statement corrupting indices.
#

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is exercising the code in main.c.
#
# $Id: main.test,v 1.16 2004/08/20 18:34:20 drh Exp $
# $Id: main.test,v 1.17 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -151,13 +151,15 @@ do_test main-1.27.2 {
UPDATE pqr SET a=5;
}
} {0}
do_test main-1.27.3 {
db complete {
/* */ EXPLAIN -- A comment
CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
ifcapable {explain} {
do_test main-1.27.3 {
db complete {
/* */ EXPLAIN -- A comment
CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
}
do_test main-1.27.4 {
db complete {
BOGUS token
@ -165,13 +167,15 @@ do_test main-1.27.4 {
UPDATE pqr SET a=5;
}
} {1}
do_test main-1.27.5 {
db complete {
EXPLAIN
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
ifcapable {explain} {
do_test main-1.27.5 {
db complete {
EXPLAIN
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
}
do_test main-1.28 {
db complete {
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc3.test,v 1.12 2004/08/20 18:34:20 drh Exp $
# $Id: misc3.test,v 1.13 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -236,20 +236,22 @@ do_test misc4-5.2 {
}
} {1 one cat 2 two {} 3 three {} 4 four dog}
# Ticket #626: make sure EXPLAIN prevents BEGIN and COMMIT from working.
#
do_test misc3-6.1 {
execsql {EXPLAIN BEGIN}
catchsql {BEGIN}
} {0 {}}
do_test misc3-6.2 {
execsql {EXPLAIN COMMIT}
catchsql {COMMIT}
} {0 {}}
do_test misc3-6.3 {
execsql {BEGIN; EXPLAIN ROLLBACK}
catchsql {ROLLBACK}
} {0 {}}
ifcapable {explain} {
# Ticket #626: make sure EXPLAIN prevents BEGIN and COMMIT from working.
#
do_test misc3-6.1 {
execsql {EXPLAIN BEGIN}
catchsql {BEGIN}
} {0 {}}
do_test misc3-6.2 {
execsql {EXPLAIN COMMIT}
catchsql {COMMIT}
} {0 {}}
do_test misc3-6.3 {
execsql {BEGIN; EXPLAIN ROLLBACK}
catchsql {ROLLBACK}
} {0 {}}
}
# Ticket #640: vdbe stack overflow with a LIMIT clause on a SELECT inside
# of a trigger.

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.5 2004/11/02 14:24:35 drh Exp $
# $Id: pagesize.test,v 1.6 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
@ -20,9 +20,11 @@ source $testdir/tester.tcl
do_test pagesize-1.1 {
execsql {PRAGMA page_size}
} 1024
do_test pagesize-1.2 {
catch {execsql {EXPLAIN PRAGMA page_size}}
} 0
ifcapable {explain} {
do_test pagesize-1.2 {
catch {execsql {EXPLAIN PRAGMA page_size}}
} 0
}
do_test pagesize-1.3 {
execsql {
CREATE TABLE t1(a);

View File

@ -12,7 +12,7 @@
#
# This file implements tests for the PRAGMA command.
#
# $Id: pragma.test,v 1.19 2004/11/03 13:59:06 drh Exp $
# $Id: pragma.test,v 1.20 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -317,17 +317,22 @@ do_test pragma-6.2 {
pragma table_info(t2)
}
} {0 a numeric 0 {} 0 1 b numeric 0 {} 0 2 c numeric 0 {} 0}
do_test pragma-6.3 {
execsql {
CREATE TABLE t3(a int references t2(b), b UNIQUE);
pragma foreign_key_list(t3);
}
} {0 0 t2 a b}
do_test pragma-6.4 {
execsql {
pragma index_list(t3);
}
} {0 sqlite_autoindex_t3_1 1}
ifcapable {foreignkey} {
do_test pragma-6.3 {
execsql {
CREATE TABLE t3(a int references t2(b), b UNIQUE);
pragma foreign_key_list(t3);
}
} {0 0 t2 a b}
do_test pragma-6.4 {
execsql {
pragma index_list(t3);
}
} {0 sqlite_autoindex_t3_1 1}
}
ifcapable {!foreignkey} {
execsql {CREATE TABLE t3(a,b UNIQUE)}
}
do_test pragma-6.5 {
execsql {
CREATE INDEX t3i1 ON t3(a,b);

View File

@ -12,7 +12,7 @@
# focus of this file is testing SELECT statements that contain
# subqueries in their FROM clause.
#
# $Id: select6.test,v 1.12 2004/08/20 18:34:20 drh Exp $
# $Id: select6.test,v 1.13 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -359,6 +359,14 @@ do_test select6-7.4 {
}
} {c abc b 2 a 1 a 1 b 2 c abc}
# The remaining tests in this file depend on the EXPLAIN keyword.
# Skip these tests if EXPLAIN is disabled in the current build.
#
ifcapable {!explain} {
finish_test
return
}
# The following procedure compiles the SQL given as an argument and returns
# TRUE if that SQL uses any transient tables and returns FALSE if no
# transient tables are used. This is used to make sure that the

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE TABLE statement.
#
# $Id: table.test,v 1.29 2004/07/24 03:30:49 drh Exp $
# $Id: table.test,v 1.30 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -254,7 +254,9 @@ do_test table-5.2 {
# Make sure an EXPLAIN does not really create a new table
#
do_test table-5.3 {
execsql {EXPLAIN CREATE TABLE test1(f1 int)}
ifcapable {explain} {
execsql {EXPLAIN CREATE TABLE test1(f1 int)}
}
execsql {SELECT name FROM sqlite_master WHERE type!='meta'}
} {}
@ -262,7 +264,9 @@ do_test table-5.3 {
#
do_test table-5.4 {
execsql {CREATE TABLE test1(f1 int)}
execsql {EXPLAIN DROP TABLE test1}
ifcapable {explain} {
execsql {EXPLAIN DROP TABLE test1}
}
execsql {SELECT name FROM sqlite_master WHERE type!='meta'}
} {test1}
@ -281,7 +285,7 @@ do_test table-7.1 {
CREATE TABLE weird(
desc text,
asc text,
explain int,
key int,
[14_vac] boolean,
fuzzy_dog_12 varchar(10),
begin blob,
@ -300,7 +304,7 @@ do_test table-7.3 {
execsql2 {
SELECT * FROM weird;
}
} {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
} {desc a asc b key 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
# Try out the CREATE TABLE AS syntax
#
@ -310,7 +314,7 @@ breakpoint
CREATE TABLE t2 AS SELECT * FROM weird;
SELECT * FROM t2;
}
} {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
} {desc a asc b key 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
do_test table-8.1.1 {
execsql {
SELECT sql FROM sqlite_master WHERE name='t2';
@ -318,7 +322,7 @@ do_test table-8.1.1 {
} {{CREATE TABLE t2(
"desc" text,
"asc" text,
"explain" int,
"key" int,
"14_vac" boolean,
fuzzy_dog_12 varchar(10),
"begin" blob,
@ -363,7 +367,7 @@ do_test table-8.6 {
execsql2 {
SELECT * FROM t2;
}
} {desc a asc b explain 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
} {desc a asc b key 9 14_vac 0 fuzzy_dog_12 xyz begin hi end y'all}
do_test table-8.7 {
catchsql {
SELECT * FROM t5;
@ -385,6 +389,7 @@ do_test table-9.1 {
# Check the foreign key syntax.
#
ifcapable {foreignkey} {
do_test table-10.1 {
catchsql {
CREATE TABLE t6(a REFERENCES t4(a) NOT NULL);
@ -476,7 +481,7 @@ do_test table-10.13 {
);
}
} {1 {unknown column "x" in foreign key definition}}
} ;# endif foreignkey
# Test for the "typeof" function. More tests for the
# typeof() function are found in bind.test and types.test.

View File

@ -15,7 +15,7 @@
# interface is pretty well tested. This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.32 2004/09/13 13:46:01 drh Exp $
# $Id: tclsqlite.test,v 1.33 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -170,24 +170,29 @@ do_test tcl-3.4 {
set rc [catch {db onecolumn {SELECT bogus}} errmsg]
lappend rc $errmsg
} {1 {no such column: bogus}}
do_test tcl-3.5 {
set b 50
set rc [catch {db one {SELECT * FROM t1 WHERE b>$b}} msg]
lappend rc $msg
} {0 41}
do_test tcl-3.6 {
set b 500
set rc [catch {db one {SELECT * FROM t1 WHERE b>$b}} msg]
lappend rc $msg
} {0 {}}
do_test tcl-3.7 {
set b 500
set rc [catch {db one {
INSERT INTO t1 VALUES(99,510);
SELECT * FROM t1 WHERE b>$b
}} msg]
lappend rc $msg
} {0 99}
ifcapable {tclvar} {
do_test tcl-3.5 {
set b 50
set rc [catch {db one {SELECT * FROM t1 WHERE b>$b}} msg]
lappend rc $msg
} {0 41}
do_test tcl-3.6 {
set b 500
set rc [catch {db one {SELECT * FROM t1 WHERE b>$b}} msg]
lappend rc $msg
} {0 {}}
do_test tcl-3.7 {
set b 500
set rc [catch {db one {
INSERT INTO t1 VALUES(99,510);
SELECT * FROM t1 WHERE b>$b
}} msg]
lappend rc $msg
} {0 99}
}
ifcapable {!tclvar} {
execsql {INSERT INTO t1 VALUES(99,510)}
}
# Turn the busy handler on and off
#
@ -203,40 +208,42 @@ do_test tcl-4.2 {
db busy
} {}
# Parsing of TCL variable names within SQL into bound parameters.
#
do_test tcl-5.1 {
execsql {CREATE TABLE t3(a,b,c)}
catch {unset x}
set x(1) 5
set x(2) 7
execsql {
INSERT INTO t3 VALUES($::x(1),$::x(2),$::x(3));
SELECT * FROM t3
}
} {5 7 {}}
do_test tcl-5.2 {
execsql {
SELECT typeof(a), typeof(b), typeof(c) FROM t3
}
} {text text null}
do_test tcl-5.3 {
catch {unset x}
set x [binary format h12 686900686f00]
execsql {
UPDATE t3 SET a=$::x;
}
db eval {
SELECT a FROM t3
} break
binary scan $a h12 adata
set adata
} {686900686f00}
do_test tcl-5.4 {
execsql {
SELECT typeof(a), typeof(b), typeof(c) FROM t3
}
} {blob text null}
ifcapable {tclvar} {
# Parsing of TCL variable names within SQL into bound parameters.
#
do_test tcl-5.1 {
execsql {CREATE TABLE t3(a,b,c)}
catch {unset x}
set x(1) 5
set x(2) 7
execsql {
INSERT INTO t3 VALUES($::x(1),$::x(2),$::x(3));
SELECT * FROM t3
}
} {5 7 {}}
do_test tcl-5.2 {
execsql {
SELECT typeof(a), typeof(b), typeof(c) FROM t3
}
} {text text null}
do_test tcl-5.3 {
catch {unset x}
set x [binary format h12 686900686f00]
execsql {
UPDATE t3 SET a=$::x;
}
db eval {
SELECT a FROM t3
} break
binary scan $a h12 adata
set adata
} {686900686f00}
do_test tcl-5.4 {
execsql {
SELECT typeof(a), typeof(b), typeof(c) FROM t3
}
} {blob text null}
}
# Operation of "break" and "continue" within row scripts
#

View File

@ -12,7 +12,7 @@
# it tests that the different storage classes (integer, real, text etc.)
# all work correctly.
#
# $Id: types.test,v 1.12 2004/11/03 13:59:06 drh Exp $
# $Id: types.test,v 1.13 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -66,9 +66,7 @@ set values {
{ NULL null null null null }
}
ifcapable {bloblit} {
lappend values {
{ X'00' blob blob blob blob }
}
lappend values { X'00' blob blob blob blob }
}
# This code tests that the storage classes specified above (in the $values

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing VIEW statements.
#
# $Id: view.test,v 1.18 2004/07/20 00:20:23 drh Exp $
# $Id: view.test,v 1.19 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -203,7 +203,10 @@ do_test view-5.2 {
} {1 22 4 55}
# Verify that the view v5 gets flattened. see sqliteFlattenSubquery().
# This will only work if EXPLAIN is enabled.
# Ticket #272
#
ifcapable {explain} {
do_test view-5.3 {
lsearch [execsql {
EXPLAIN SELECT * FROM v5;
@ -239,6 +242,7 @@ do_test view-5.9 {
EXPLAIN SELECT * FROM t1 AS a, v5 AS b, t2 AS c WHERE a.x=b.v AND b.w=c.y;
}] OpenTemp
} {-1}
} ;# endif explain
do_test view-6.1 {
execsql {

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the use of indices in WHERE clases.
#
# $Id: where.test,v 1.22 2004/08/20 18:34:20 drh Exp $
# $Id: where.test,v 1.23 2004/11/03 16:27:02 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -356,15 +356,17 @@ do_test where-5.14 {
}
} {2 1 9 7}
# This procedure executes the SQL. Then it checks the generated program
# for the SQL and appends a "nosort" to the result if the program contains the
# SortCallback opcode. If the program does not contain the SortCallback
# opcode it appends "sort"
# This procedure executes the SQL. Then it checks to see if the OP_Sort
# opcode was executed. If an OP_Sort did occur, then "sort" is appended
# to the result. If no OP_Sort happened, then "nosort" is appended.
#
# This procedure is used to check to make sure sorting is or is not
# occurring as expected.
#
proc cksort {sql} {
set ::sqlite_sort_count 0
set data [execsql $sql]
set prog [execsql "EXPLAIN $sql"]
if {[regexp Sort $prog]} {set x sort} {set x nosort}
if {$::sqlite_sort_count} {set x sort} {set x nosort}
lappend data $x
return $data
}
@ -501,17 +503,6 @@ do_test where-6.16 {
SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t1.x, t3.a LIMIT 3
}
} {1 0 2 1 3 1 sort}
#### Version 3 does not work this way:
#do_test where-6.17 {
# cksort {
# SELECT y FROM t1 ORDER BY w COLLATE text LIMIT 3;
# }
#} {4 121 10201 sort}
#do_test where-6.18 {
# cksort {
# SELECT y FROM t1 ORDER BY w COLLATE numeric LIMIT 3;
# }
#} {4 9 16 sort}
do_test where-6.19 {
cksort {
SELECT y FROM t1 ORDER BY w LIMIT 3;

View File

@ -123,7 +123,7 @@ static Keyword aKeywordTable[] = {
{ "CURRENT_TIMESTAMP","TK_CTIMESTAMP", ALWAYS },
{ "DATABASE", "TK_DATABASE", ATTACH },
{ "DEFAULT", "TK_DEFAULT", ALWAYS },
{ "DEFERRED", "TK_DEFERRED", FKEY },
{ "DEFERRED", "TK_DEFERRED", ALWAYS },
{ "DEFERRABLE", "TK_DEFERRABLE", FKEY },
{ "DELETE", "TK_DELETE", ALWAYS },
{ "DESC", "TK_DESC", ALWAYS },
@ -145,7 +145,7 @@ static Keyword aKeywordTable[] = {
{ "GROUP", "TK_GROUP", ALWAYS },
{ "HAVING", "TK_HAVING", ALWAYS },
{ "IGNORE", "TK_IGNORE", CONFLICT|TRIGGER },
{ "IMMEDIATE", "TK_IMMEDIATE", FKEY },
{ "IMMEDIATE", "TK_IMMEDIATE", ALWAYS },
{ "IN", "TK_IN", ALWAYS },
{ "INDEX", "TK_INDEX", ALWAYS },
{ "INITIALLY", "TK_INITIALLY", FKEY },