Test suite fixes for builds that define OMIT symbols. (CVS 2962)

FossilOrigin-Name: 3a54a33dcb7e765ee3773397407e8929a8cfe1a9
This commit is contained in:
danielk1977 2006-01-17 09:35:01 +00:00
parent ff890793fc
commit 3bdca9c9a5
40 changed files with 819 additions and 625 deletions

View File

@ -1,5 +1,5 @@
C Test\sfile\sfixes\sfor\slibaries\scompiled\swith\svarious\sSQLITE_OMIT_\smacros.\s(CVS\s2961)
D 2006-01-16T16:24:25
C Test\ssuite\sfixes\sfor\sbuilds\sthat\sdefine\sOMIT\ssymbols.\s(CVS\s2962)
D 2006-01-17T09:35:02
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -97,9 +97,9 @@ F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772
F src/where.c 9fd58a8f5525d036a088c92bb14e2885c2243bc8
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/all.test a23fcbbf1f53515bde840d78732a6d94c673b327
F test/alter.test 1ac1263c8436bce05143565ed79c3c3c7c4bacaa
F test/alter.test d2569ed639946be29cfcae9117942b4a6d01f719
F test/alter2.test cc0b8832e4e98605dbc26910efd4bb89abe59cb2
F test/alter3.test a06d53b2dd1e16cb6f6d44022f9ca04c94da433e
F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7
F test/altermalloc.test 6e1f404ec021eb2ba6582e3c77b0a35cf206b7af
F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0
F test/async.test 0f71d47219311c1e7c65b95ef18faa7b65472913
@ -107,14 +107,14 @@ F test/attach.test 036315207c477211470168bf121b1c493f781515
F test/attach2.test 0e6a7c54343c85dd877a1e86073a05176043ed40
F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe
F test/attachmalloc.test cdb26c42850f04698377ccec05f5fa89d987837c
F test/auth.test 639288b5dace7db3e1fce85d38893fc30bbfe50b
F test/auth.test 0e8d4fd60bec027adb0abf7874051f8b90d9c6b6
F test/autoinc.test 60005a676e3e4e17dfa9dbd08aa0b76587ff97e3
F test/autovacuum.test 0dd22b0e1fe2013abe03e2ef5000bb3b9c1b6666
F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31
F test/autovacuum_ioerr.test c46a76869cb6eddbbb40b419b2b6c4c001766b1f
F test/autovacuum_ioerr2.test 2f8a3fb31f833fd0ca86ad4ad98913c73e807572
F test/avtrans.test 507834a6e1ef4aeea9b8bc2b45f9246d7e66ad3f
F test/between.test ca092fa28b665ca92172b182c6c360a92f7ca348
F test/avtrans.test 49a319fc423a133432179e060824d1c10260714d
F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bind.test 7c01e8a660e33586bc0c1d596d5a7a7f5e7523fe
@ -129,17 +129,17 @@ F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f
F test/btree8.test fadc112bcbd6a0c622d34c813fc8a648eacf8804
F test/busy.test 0271c854738e23ad76e10d4096a698e5af29d211
F test/capi2.test b9354d6c37e6f8f858c08952ebc9709712581221
F test/capi3.test 318098b606490b2e29c6228743e5c4b37da8c368
F test/capi3.test 128b418bc0ac567c7e844287a50fc6234e6d5c5d
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/cast.test aabdcb3873bb2f40d855bf63950f6d99a5a196c7
F test/check.test 686df5fd9fb986198787f00a79d86b68feb02e32
F test/check.test 55ad950d7ad24d6eb3328c54149f90d38a39a962
F test/collate1.test add9454cef160677bb8b34148b8f277ce7f9f1c4
F test/collate2.test 224a632ba04907c049804b08162efd234aa7871f
F test/collate3.test 947a77f5b8227e037a7094d0e338a5504f155cc4
F test/collate4.test daf498e294dcd596b961d425c3f2dda117e4717e
F test/collate5.test 8fb4e7e0241839356bd8710f437c32efb47bfff8
F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
F test/conflict.test bc7b81670abfd6ca51cbcbf46ef23cd52784fafd
F test/conflict.test 16533a92675f9752c25596093a4d549af7fc3d34
F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
F test/corrupt2.test 88342570828f2b8cbbd8369eff3891f5c0bdd5ba
F test/crash.test 5f5f155393c5685b3842fef79b6fbafa55197d75
@ -161,12 +161,12 @@ F test/expr.test a513aceb5d89042232e0d07ac5a1591965cf3963
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
F test/func.test a7119afcc16abdf24b24486684fb888279008f75
F test/hook.test 60579eb9db0c8de27c6d92661d6912612bef5e1f
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
F test/in.test cead6165aebbe0d451bb2263a307173acfeb6240
F test/index.test c90ab389586dbddfeb6817cd137737b2de1b6522
F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
F test/insert.test 51ab0b19169c91d7b3f64009d309ed5cf1b48df5
F test/insert.test b4d43f8e75e203fe51bc06cacf3636081903dcd1
F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed
F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95
F test/interrupt.test cd24dc5bedd02325be4bfa5d6209fae01c465157
@ -180,8 +180,8 @@ F test/join5.test 2646825693a6e066ea89b498176d4a68df45ab68
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/lastinsert.test 9d7241f562d7adcf61730de83176417d7e30d76b
F test/laststmtchanges.test 19a6d0c11f7a31dc45465b495f7b845a62cbec17
F test/like.test 145382e6a1f3d2edf266ca7d0236ab1b7c0ba66f
F test/limit.test 4b538057d5b5c7ca10ec8d40d6c567e886c90bdd
F test/like.test 1665284b66060934568e2b4a69ad4f9033ecb5dd
F test/limit.test f593d0ff02b3ab657d08e4ffbf14081bda763393
F test/lock.test 9b7afcb24f53d24da502abb33daaad2cd6d44107
F test/lock2.test d83ba79d3c4fffdb5b926c7d8ca7a36c34288a55
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
@ -192,28 +192,28 @@ F test/malloc3.test 265644c655497242f7c0a1bb5b36c8500a5fc27c
F test/malloc4.test 2e29d155eb4b4808019ef47eeedfcbe9e09e0f05
F test/malloc5.test 7c0a02ab2fef82af6febacc02e033514f1674066
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
F test/memdb.test 1860e060be810bf0775bc57408a5b7c4954bcaea
F test/memdb.test ed97df0414a6e33e043e3eeffccb54d06098d0ae
F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac
F test/minmax.test cad887abca5504396718e2cd5729ca40758743e8
F test/misc1.test 7aabf32e698ef7cc1253f5e7fc216c65870ce485
F test/misc2.test 17949ae34df8a60e318b2a14492b8cb62cd2072a
F test/misc1.test 5a9cfffc59e5da583492a1c07efcb08a48cd1135
F test/misc2.test 09388e5a2c5c1017ad3ff1c4bf469375def2a0c2
F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03
F test/misc4.test b043a05dea037cca5989f3ae09552fa16119bc80
F test/misc5.test aa5d7b4ef0963aaa87c18654e266682ca3565779
F test/misc5.test cff0e9ff3a79c5116d5bce077a0bacf9bb300324
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test db52272f9628ae9e77ab451cf0fb3871a98c5f00
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
F test/null.test 9503e1f63e959544c006d9f01709c5b5eab67d54
F test/pager.test 1579e8f07291ae8e24db62ffade5c101c3e76597
F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pagesize.test cbc6a312b6f6c0f02619b189985df2a14164b690
F test/pagesize.test 05c74ea49f790734ec1e9ab765d9bf1cce79b8f2
F test/pragma.test 8759b46702f6d8ee4f5dd520216c69dbc9080b60
F test/printf.test 9e10c74e16bf889f8495ddb3d6f5f891e75ff1b7
F test/progress.test 16496001da445e6534afb94562c286708316d82f x
F test/quick.test 2d2cf1b50e894b19b4029dd9a68ec59599b24f18
F test/quote.test 5891f2338980916cf7415484b4ce785294044adb
F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b
F test/rollback.test fc6be5a5e4b1347fd96777c65484a24fc75e8f0e
F test/rollback.test 673cd8c44c685ad54987fe7f0eeba84efa09685d
F test/rowid.test 040a3bef06f970c45f5fcd14b2355f7f4d62f0cf
F test/safety.test 4a06934e45d03b8b50ebcd8d174eb0367d2fd851
F test/schema.test 8a2ae440fb15f5798a68059e8746402f3137be46
@ -225,35 +225,35 @@ F test/select5.test 07a90ab3c7e3f0a241a9cdea1d997b2c8a89ff0b
F test/select6.test f459a19bdac0501c4d3eb1a4df4b7a76f1bb8ad4
F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
F test/shared.test 79bec0fa6c12b536d62a1304c6389348aa6ec6bd
F test/shared.test fa058377c914a1abfc7d2247864d0471906111fd
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
F test/sync.test 6e8b885cec5ccba2090e92c90f747a7142f53c88
F test/sync.test 0c43399676de101e3af4d6069a94e211bb77f6b9
F test/table.test 6dc0dfa44dd429520e0e5a0c5e55025f730e9403
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 2c4b5fb2f21e6740479463c263f3020f08e472d7
F test/tclsqlite.test 9b5c4a09879a97572e5c84372f5d045dd4703392
F test/temptable.test 7927261befdbc7b0a7ffebb85ecc70a74fa7b15b
F test/tester.tcl 1f90490c63a2529ba94ca4f67608feddd33cfbcf
F test/tester.tcl b260c1acda75b4a1a03ef0c9c5582e466e350b06
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/thread2.test c88da55fb60d5975be91f1e2942a5e267c33f8ed
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
F test/tkt1435.test f768e5415d102fa1d8de3f548469d8fd1b79abd8
F test/tkt1443.test bbd1fa7070783845aa42cdd35867a5ac73e5947a
F test/tkt1444.test 31e25ca9f850e4d75ce5fcaa69f1f96558ad9416
F test/tkt1449.test 541021eb3c652848deb44f1407d692a9c42b6099
F test/tkt1473.test fd90eaa945d930e6f1bbb7b024848f83f063bc5d
F test/tkt1501.test 0cf859299f0052ecfaf7db6f0984f122c7db5d15
F test/tkt1512.test 8efd8d07e27e99d7462f75b5711de65eb7708baf
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
F test/tkt1443.test bacc311da5c96a227bf8c167e77a30c99f8e8368
F test/tkt1444.test b8de3146ad0be7e39e95aa9d53c66740eaa7f192
F test/tkt1449.test 93584a449752d52b07d2cfc280a69842b6e16ed5
F test/tkt1473.test 9d000af3e11a4450d4c596f5e58b4b0d24eb0f8b
F test/tkt1501.test 2064f98e00871848af4b2f517e46c1a7fb2e32db
F test/tkt1512.test d8cd5f1c16103b5bc3ccf254731f63e69c364d1d
F test/tkt1514.test baa587a69fa2e8d575ebdaf1460f711281dcba49
F test/tkt1536.test 83ff7a7b6e248016f8d682d4f7a4ae114070d466
F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808
F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f
F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567
F test/trans.test abd2f74c5685b156d79438e6e812db5bf984eea4
F test/trigger1.test 152aed5a1fa90709fe171f2ca501a6b7f7901479
F test/trigger2.test dea71f4b05e22896e72527278bc8ef71b7475bf2
F test/trans.test b25eae982d156867eac338409905fd4ca589b7f8
F test/trigger1.test 0c1d44882dba5c92e4efee4dd133cc979f0b1860
F test/trigger2.test 33bf8ae9b788013be194efe5f66c04a202facbb4
F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2
F test/trigger4.test 4bed3705c9df4aaf7a7b164a2d573410d05ca025
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
@ -261,7 +261,7 @@ F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9
F test/trigger7.test 0afa870be2ce1b132cdb85b17a4a4ef45aa8cece
F test/types.test a74083427a73ff8af2723bae209d09cce5722c3a
F test/types2.test 81dd1897be8ef4b5b73d0006e6076abe40610de3
F test/types3.test f9098dbb92bbc67cdde9dda70d65cded10ca3eb0
F test/types3.test ea0ddf793ad5cd17c3b029dd8f48473059f873b6
F test/unique.test 0253c4227a5dc533e312202ce21ecfad18058d18
F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf
F test/utf16.test f9c13f4e2b48c42d0bfc96647d82fdf7bc11fc55
@ -270,7 +270,7 @@ F test/vacuum2.test 5aea8c88a65cb29f7d175296e7c819c6158d838c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 354bd0ceb363e88da8ce98fb47e18550d7594b13
F test/where.test ee7c9a6659b07e1ee61177f6e7ff71565ee2c9df
F test/where2.test 2a50005957786861c3e9261bf25d7479cad63fc9
F test/where2.test fde821b9cb8e20d53ccd2e71482b063c5b1e222a
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 26d271a753ef87fe1e6194f53c594ab5e6783d85
F tool/lempar.c 424df14a48736bb961ed47acf30c26d66ed85a62
@ -341,7 +341,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 36b03259654ffa9b14ebe1093984b29e9efbd56c
R 75313d1d094051d9599acb13b95119d7
P c058f483a52c8043178b6329aa5e58bedf0c8277
R c86983ffa2db3b82ac2e0f38dbf58ee1
U danielk1977
Z 235cd671730832e0ed73a26dff915eed
Z fc44b9175931850bbe296b28d7e15e37

View File

@ -1 +1 @@
c058f483a52c8043178b6329aa5e58bedf0c8277
3a54a33dcb7e765ee3773397407e8929a8cfe1a9

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing the ALTER TABLE statement.
#
# $Id: alter.test,v 1.15 2006/01/15 14:11:49 danielk1977 Exp $
# $Id: alter.test,v 1.16 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -567,9 +567,9 @@ do_test alter-6.2 {
CREATE TABLE ${tbl_name}(a, b, c);
"
set ::oid [execsql {SELECT max(oid) FROM sqlite_master}]
execsql {
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
"
} "{CREATE TABLE ${::tbl_name}(a, b, c)}"
execsql "
SELECT * FROM ${::tbl_name}
@ -579,26 +579,26 @@ do_test alter-6.3 {
execsql "
ALTER TABLE $::tbl_name RENAME TO $::tbl_name2
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name2}'(a, b, c)}"
do_test alter-6.4 {
execsql "
ALTER TABLE $::tbl_name2 RENAME TO $::tbl_name
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c)}"
set ::col_name ghi\1234\jkl
do_test alter-6.5 {
execsql "
ALTER TABLE $::tbl_name ADD COLUMN $::col_name VARCHAR
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR)}"
set ::col_name2 B\3421\A
do_test alter-6.6 {
@ -607,9 +607,9 @@ do_test alter-6.6 {
execsql "
ALTER TABLE $::tbl_name ADD COLUMN $::col_name2
"
execsql {
SELECT sql FROM sqlite_master WHERE oid = $::oid;
}
execsql "
SELECT sql FROM sqlite_master WHERE oid = $::oid
"
} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR, $::col_name2)}"
do_test alter-6.7 {
execsql "

View File

@ -13,7 +13,7 @@
# file format change that may be used in the future to implement
# "ALTER TABLE ... ADD COLUMN".
#
# $Id: alter3.test,v 1.8 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: alter3.test,v 1.9 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -143,14 +143,16 @@ do_test alter3-2.4 {
ALTER TABLE t1 ADD c NOT NULL DEFAULT 10;
}
} {0 {}}
do_test alter3-2.5 {
execsql {
CREATE VIEW v1 AS SELECT * FROM t1;
}
catchsql {
alter table v1 add column d;
}
} {1 {Cannot add a column to a view}}
ifcapable view {
do_test alter3-2.5 {
execsql {
CREATE VIEW v1 AS SELECT * FROM t1;
}
catchsql {
alter table v1 add column d;
}
} {1 {Cannot add a column to a view}}
}
do_test alter3-2.6 {
catchsql {
alter table t1 add column d DEFAULT CURRENT_TIME;
@ -186,11 +188,13 @@ if {!$has_codec} {
get_file_format
} {3}
}
do_test alter3-3.4 {
execsql {
PRAGMA schema_version;
}
} {11}
ifcapable schema_version {
do_test alter3-3.4 {
execsql {
PRAGMA schema_version;
}
} {11}
}
do_test alter3-4.1 {
db close
@ -219,11 +223,13 @@ if {!$has_codec} {
get_file_format
} {3}
}
do_test alter3-4.4 {
execsql {
PRAGMA schema_version;
}
} {21}
ifcapable schema_version {
do_test alter3-4.4 {
execsql {
PRAGMA schema_version;
}
} {21}
}
do_test alter3-4.99 {
execsql {
DROP TABLE t1;
@ -254,11 +260,13 @@ do_test alter3-5.3 {
SELECT * FROM aux.t1;
}
} {1 one {} 2 two {}}
do_test alter3-5.4 {
execsql {
PRAGMA aux.schema_version;
}
} {31}
ifcapable schema_version {
do_test alter3-5.4 {
execsql {
PRAGMA aux.schema_version;
}
} {31}
}
if {!$has_codec} {
do_test alter3-5.5 {
list [get_file_format test2.db] [get_file_format]
@ -275,11 +283,13 @@ do_test alter3-5.7 {
SELECT * FROM aux.t1;
}
} {1 one {} 1000 2 two {} 1000}
do_test alter3-5.8 {
execsql {
PRAGMA aux.schema_version;
}
} {32}
ifcapable schema_version {
do_test alter3-5.8 {
execsql {
PRAGMA aux.schema_version;
}
} {32}
}
do_test alter3-5.9 {
execsql {
SELECT * FROM t1;

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands
# and related functionality.
#
# $Id: auth.test,v 1.32 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: auth.test,v 1.33 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -2092,32 +2092,32 @@ do_test auth-2.11.2 {
# Make sure the OLD and NEW pseudo-tables of a trigger get authorized.
#
ifcapable trigger {
do_test auth-3.1 {
proc auth {code arg1 arg2 arg3 arg4} {
return SQLITE_OK
}
execsql {
CREATE TABLE tx(a1,a2,b1,b2,c1,c2);
CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c);
END;
UPDATE t2 SET a=a+1;
SELECT * FROM tx;
}
} {11 12 2 2 33 33 7 8 8 8 9 9}
do_test auth-3.2 {
proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} {
return SQLITE_IGNORE
do_test auth-3.1 {
proc auth {code arg1 arg2 arg3 arg4} {
return SQLITE_OK
}
return SQLITE_OK
}
execsql {
DELETE FROM tx;
UPDATE t2 SET a=a+100;
SELECT * FROM tx;
}
} {12 112 2 2 {} {} 8 108 8 8 {} {}}
execsql {
CREATE TABLE tx(a1,a2,b1,b2,c1,c2);
CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW BEGIN
INSERT INTO tx VALUES(OLD.a,NEW.a,OLD.b,NEW.b,OLD.c,NEW.c);
END;
UPDATE t2 SET a=a+1;
SELECT * FROM tx;
}
} {11 12 2 2 33 33 7 8 8 8 9 9}
do_test auth-3.2 {
proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="c"} {
return SQLITE_IGNORE
}
return SQLITE_OK
}
execsql {
DELETE FROM tx;
UPDATE t2 SET a=a+100;
SELECT * FROM tx;
}
} {12 112 2 2 {} {} 8 108 8 8 {} {}}
} ;# ifcapable trigger
# Make sure the names of views and triggers are passed on on arg4.
@ -2210,7 +2210,17 @@ do_test auth-5.1 {
# Ticket #1607
#
ifcapable compound {
ifcapable compound&&subquery {
ifcapable trigger {
execsql {
DROP TABLE tx;
}
ifcapable view {
execsql {
DROP TABLE v1chng;
}
}
}
do_test auth-5.2 {
execsql {
SELECT name FROM (
@ -2218,7 +2228,7 @@ ifcapable compound {
WHERE type='table'
ORDER BY name
}
} {sqlite_stat1 t1 t2 t3 t4 tx v1chng}
} {sqlite_stat1 t1 t2 t3 t4}
}

View File

@ -12,7 +12,7 @@
# file is a copy of "trans.test" modified to run under autovacuum mode.
# the point is to stress the autovacuum logic and try to get it to fail.
#
# $Id: avtrans.test,v 1.1 2005/12/09 02:35:54 drh Exp $
# $Id: avtrans.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@ -896,9 +896,15 @@ for {set i 2} {$i<=$limit} {incr i} {
do_test avtrans-9.$i.4-$cnt {
expr {$sqlite_sync_count>0}
} 1
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
ifcapable pager_pragmas {
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
} else {
do_test avtrans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} {1}
}
}
}
set ::pager_old_format 0

View File

@ -12,7 +12,7 @@
# focus of this file is testing the use of indices in WHERE clauses
# when the WHERE clause contains the BETWEEN operator.
#
# $Id: between.test,v 1.1 2005/07/28 23:12:08 drh Exp $
# $Id: between.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -29,7 +29,14 @@ do_test between-1.0 {
set x [expr {int(log($i)/log(2))}]
set y [expr {$i*$i + 2*$i + 1}]
set z [expr {$x+$y}]
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
ifcapable tclvar {
# Random unplanned test of the $varname variable syntax.
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
} else {
# If the $varname syntax is not available, use the regular variable
# declaration syntax.
execsql {INSERT INTO t1 VALUES(:w,:x,:y,:z)}
}
}
execsql {
CREATE UNIQUE INDEX i1w ON t1(w);

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: capi3.test,v 1.38 2006/01/13 01:25:06 drh Exp $
# $Id: capi3.test,v 1.39 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -111,18 +111,22 @@ ifcapable {utf16} {
do_test capi3-2.5 {
sqlite3_errmsg $DB
} {no such column: namex}
do_test capi3-2.6 {
execsql {CREATE TABLE tablename(x)}
set sql16 [utf16 {PRAGMA table_info("TableName")}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-2.7 {
sqlite3_step $STMT
} SQLITE_DONE
do_test capi3-2.8 {
sqlite3_finalize $STMT
} SQLITE_OK
ifcapable schema_pragmas {
do_test capi3-2.6 {
execsql {CREATE TABLE tablename(x)}
set sql16 [utf16 {PRAGMA table_info("TableName")}]
set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-2.7 {
sqlite3_step $STMT
} SQLITE_DONE
do_test capi3-2.8 {
sqlite3_finalize $STMT
} SQLITE_OK
}
} ;# endif utf16
# rename sqlite3_open sqlite3_open_old

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing CHECK constraints
#
# $Id: check.test,v 1.7 2006/01/14 08:02:28 danielk1977 Exp $
# $Id: check.test,v 1.8 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -272,11 +272,13 @@ do_test check-4.8 {
UPDATE t4 SET x=0, y=2;
}
} {1 {constraint failed}}
do_test check_4.9 {
catchsql {
VACUUM
}
} {0 {}}
ifcapable vacuum {
do_test check_4.9 {
catchsql {
VACUUM
}
} {0 {}}
}
do_test check-5.1 {
catchsql {

View File

@ -13,11 +13,16 @@
# This file implements tests for the conflict resolution extension
# to SQLite.
#
# $Id: conflict.test,v 1.26 2005/09/25 01:13:09 drh Exp $
# $Id: conflict.test,v 1.27 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !conflict {
finish_test
return
}
# Create tables for the first group of tests.
#
do_test conflict-1.0 {

View File

@ -17,7 +17,7 @@
# sqlite_update_hook (tests hook-4-*)
# sqlite_rollback_hook (tests hook-5.*)
#
# $Id: hook.test,v 1.10 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: hook.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -138,37 +138,44 @@ do_test hook-4.1.2 {
]
set ::update_hook {}
do_test hook-4.2.1 {
catchsql {
DROP TABLE t2;
}
execsql {
CREATE TABLE t2(c INTEGER PRIMARY KEY, d);
CREATE TRIGGER t1_trigger AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a, new.b);
UPDATE t2 SET d = d || ' via trigger' WHERE new.a = c;
DELETE FROM t2 WHERE new.a = c;
END;
}
} {}
do_test hook-4.2.2 {
ifcapable trigger {
do_test hook-4.2.1 {
catchsql {
DROP TABLE t2;
}
execsql {
CREATE TABLE t2(c INTEGER PRIMARY KEY, d);
CREATE TRIGGER t1_trigger AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a, new.b);
UPDATE t2 SET d = d || ' via trigger' WHERE new.a = c;
DELETE FROM t2 WHERE new.a = c;
END;
}
} {}
do_test hook-4.2.2 {
execsql {
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, 'two');
}
set ::update_hook
} [list \
INSERT main t1 1 \
INSERT main t2 1 \
UPDATE main t2 1 \
DELETE main t2 1 \
INSERT main t1 2 \
INSERT main t2 2 \
UPDATE main t2 2 \
DELETE main t2 2 \
]
} else {
execsql {
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, 'two');
}
set ::update_hook
} [list \
INSERT main t1 1 \
INSERT main t2 1 \
UPDATE main t2 1 \
DELETE main t2 1 \
INSERT main t1 2 \
INSERT main t2 2 \
UPDATE main t2 2 \
DELETE main t2 2 \
]
}
# Triggers + ATTACH
# Update-hook + ATTACH
set ::update_hook {}
do_test hook-4.2.3 {
file delete -force test2.db
@ -188,12 +195,17 @@ do_test hook-4.2.3 {
DELETE aux t3 2 \
]
ifcapable trigger {
execsql {
DROP TRIGGER t1_trigger;
}
}
# Test that other vdbe operations involving btree structures do not
# incorrectly invoke the update-hook.
set ::update_hook {}
do_test hook-4.3.1 {
execsql {
DROP TRIGGER t1_trigger;
CREATE INDEX t1_i ON t1(b);
INSERT INTO t1 VALUES(3, 'three');
UPDATE t1 SET b = '';

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.40 2006/01/04 15:54:37 drh Exp $
# $Id: index.test,v 1.41 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -640,46 +640,48 @@ do_test index-18.5 {
# These tests ensure that if multiple table definition constraints are
# implemented by a single indice, the correct ON CONFLICT policy applies.
do_test index-19.1 {
execsql {
CREATE TABLE t7(a UNIQUE PRIMARY KEY);
CREATE TABLE t8(a UNIQUE PRIMARY KEY ON CONFLICT ROLLBACK);
INSERT INTO t7 VALUES(1);
INSERT INTO t8 VALUES(1);
}
} {}
do_test index-19.2 {
catchsql {
BEGIN;
INSERT INTO t7 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.3 {
catchsql {
BEGIN;
}
} {1 {cannot start a transaction within a transaction}}
do_test index-19.4 {
catchsql {
INSERT INTO t8 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.5 {
catchsql {
BEGIN;
COMMIT;
}
} {0 {}}
do_test index-19.6 {
catchsql {
DROP TABLE t7;
DROP TABLE t8;
CREATE TABLE t7(
a PRIMARY KEY ON CONFLICT FAIL,
UNIQUE(a) ON CONFLICT IGNORE
);
}
} {1 {conflicting ON CONFLICT clauses specified}}
ifcapable conflict {
do_test index-19.1 {
execsql {
CREATE TABLE t7(a UNIQUE PRIMARY KEY);
CREATE TABLE t8(a UNIQUE PRIMARY KEY ON CONFLICT ROLLBACK);
INSERT INTO t7 VALUES(1);
INSERT INTO t8 VALUES(1);
}
} {}
do_test index-19.2 {
catchsql {
BEGIN;
INSERT INTO t7 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.3 {
catchsql {
BEGIN;
}
} {1 {cannot start a transaction within a transaction}}
do_test index-19.4 {
catchsql {
INSERT INTO t8 VALUES(1);
}
} {1 {column a is not unique}}
do_test index-19.5 {
catchsql {
BEGIN;
COMMIT;
}
} {0 {}}
do_test index-19.6 {
catchsql {
DROP TABLE t7;
DROP TABLE t8;
CREATE TABLE t7(
a PRIMARY KEY ON CONFLICT FAIL,
UNIQUE(a) ON CONFLICT IGNORE
);
}
} {1 {conflicting ON CONFLICT clauses specified}}
} ; # end of "ifcapable conflict" block
ifcapable {reindex} {
do_test index-19.7 {

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.28 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: insert.test,v 1.29 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -288,34 +288,43 @@ ifcapable tempdb {
# Ticket #334: REPLACE statement corrupting indices.
#
do_test insert-6.1 {
execsql {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(2,3);
SELECT b FROM t1 WHERE b=2;
ifcapable conflict {
# The REPLACE command is not available if SQLITE_OMIT_CONFLICT is
# defined at compilation time.
do_test insert-6.1 {
execsql {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(2,3);
SELECT b FROM t1 WHERE b=2;
}
} {2}
do_test insert-6.2 {
execsql {
REPLACE INTO t1 VALUES(1,4);
SELECT b FROM t1 WHERE b=2;
}
} {}
do_test insert-6.3 {
execsql {
UPDATE OR REPLACE t1 SET a=2 WHERE b=4;
SELECT * FROM t1 WHERE b=4;
}
} {2 4}
do_test insert-6.4 {
execsql {
SELECT * FROM t1 WHERE b=3;
}
} {}
ifcapable {reindex} {
do_test insert-6.5 {
execsql REINDEX
} {}
}
} {2}
do_test insert-6.2 {
execsql {
REPLACE INTO t1 VALUES(1,4);
SELECT b FROM t1 WHERE b=2;
}
} {}
do_test insert-6.3 {
execsql {
UPDATE OR REPLACE t1 SET a=2 WHERE b=4;
SELECT * FROM t1 WHERE b=4;
}
} {2 4}
do_test insert-6.4 {
execsql {
SELECT * FROM t1 WHERE b=3;
}
} {}
ifcapable {reindex} {
do_test insert-6.7 {
execsql REINDEX
do_test insert-6.6 {
execsql {
DROP TABLE t1;
}
} {}
}
@ -324,7 +333,6 @@ ifcapable {reindex} {
# INSERT statments.
do_test insert-7.1 {
execsql {
DROP TABLE t1;
CREATE TABLE t1(a);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);

View File

@ -13,7 +13,7 @@
# in particular the optimizations that occur to help those operators
# run faster.
#
# $Id: like.test,v 1.3 2005/08/28 17:00:26 drh Exp $
# $Id: like.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -40,7 +40,7 @@ do_test like-1.0 {
CDE
{ABC abc xyz}
} {
db eval {INSERT INTO t1 VALUES($str)}
db eval {INSERT INTO t1 VALUES(:str)}
}
execsql {
SELECT count(*) FROM t1;

View File

@ -12,7 +12,7 @@
# focus of this file is testing the LIMIT ... OFFSET ... clause
# of SELECT statements.
#
# $Id: limit.test,v 1.26 2006/01/08 18:10:18 drh Exp $
# $Id: limit.test,v 1.27 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -404,27 +404,27 @@ ifcapable compound {
do_test limit-10.1 {
set limit 10
db eval {
SELECT x FROM t1 LIMIT $limit;
SELECT x FROM t1 LIMIT :limit;
}
} {31 30 29 28 27 26 25 24 23 22}
do_test limit-10.2 {
set limit 5
set offset 5
db eval {
SELECT x FROM t1 LIMIT $limit OFFSET $offset;
SELECT x FROM t1 LIMIT :limit OFFSET :offset;
}
} {26 25 24 23 22}
do_test limit-10.3 {
set limit -1
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
}
} {9 8 7 6 5 4 3 2 1 0}
do_test limit-10.4 {
set limit 1.5
set rc [catch {
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
} } msg]
list $rc $msg
} {1 {datatype mismatch}}
@ -432,7 +432,7 @@ do_test limit-10.5 {
set limit "hello world"
set rc [catch {
db eval {
SELECT x FROM t1 WHERE x<10 LIMIT $limit;
SELECT x FROM t1 WHERE x<10 LIMIT :limit;
} } msg]
list $rc $msg
} {1 {datatype mismatch}}

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is in-memory database backend.
#
# $Id: memdb.test,v 1.13 2005/01/21 04:25:47 danielk1977 Exp $
# $Id: memdb.test,v 1.14 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@ -169,6 +169,11 @@ foreach {i conf cmd t0 t1 t2} {
6 {} {INSERT OR ABORT} 1 {} 1
7 {} {INSERT OR ROLLBACK} 1 {} {}
} {
# All tests after test 1 depend on conflict resolution. So end the
# loop if that is not available in this build.
ifcapable !conflict {if {$i>1} break}
do_test memdb-4.$i {
if {$conf!=""} {set conf "ON CONFLICT $conf"}
set r0 [catch {execsql [subst {
@ -229,6 +234,12 @@ foreach {i conf1 conf2 cmd t0 t1 t2} {
15 {} {} {UPDATE OR ABORT} 1 {1 2 3 4} 1
16 {} {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0
} {
# All tests after test 1 depend on conflict resolution. So end the
# loop if that is not available in this build.
ifcapable !conflict {
if {$i>1} break
}
if {$t0} {set t1 {column a is not unique}}
do_test memdb-5.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
@ -321,26 +332,30 @@ do_test memdb-6.11 {
SELECT * FROM t5 ORDER BY y DESC;
}
} {}
do_test memdb-6.12 {
execsql {
INSERT INTO t5 VALUES(1,2);
INSERT INTO t5 VALUES(3,4);
REPLACE INTO t5 VALUES(1,4);
SELECT rowid,* FROM t5;
}
} {3 1 4}
do_test memdb-6.13 {
execsql {
DELETE FROM t5 WHERE x>5;
SELECT * FROM t5;
}
} {1 4}
do_test memdb-6.14 {
execsql {
DELETE FROM t5 WHERE y<3;
SELECT * FROM t5;
}
} {1 4}
ifcapable conflict {
do_test memdb-6.12 {
execsql {
INSERT INTO t5 VALUES(1,2);
INSERT INTO t5 VALUES(3,4);
REPLACE INTO t5 VALUES(1,4);
SELECT rowid,* FROM t5;
}
} {3 1 4}
do_test memdb-6.13 {
execsql {
DELETE FROM t5 WHERE x>5;
SELECT * FROM t5;
}
} {1 4}
do_test memdb-6.14 {
execsql {
DELETE FROM t5 WHERE y<3;
SELECT * FROM t5;
}
} {1 4}
}
do_test memdb-6.15 {
execsql {
DELETE FROM t5 WHERE x>0;

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc1.test,v 1.39 2005/11/01 15:48:25 drh Exp $
# $Id: misc1.test,v 1.40 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -364,18 +364,20 @@ do_test misc1-12.4 {
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.5 {
execsql {
INSERT OR IGNORE INTO t6 VALUES(0.0,'x');
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.6 {
execsql {
INSERT OR IGNORE INTO t6 VALUES('y',0);
SELECT * FROM t6;
}
} {0 0.0 y 0}
ifcapable conflict {
do_test misc1-12.5 {
execsql {
INSERT OR IGNORE INTO t6 VALUES(0.0,'x');
SELECT * FROM t6;
}
} {0 0.0}
do_test misc1-12.6 {
execsql {
INSERT OR IGNORE INTO t6 VALUES('y',0);
SELECT * FROM t6;
}
} {0 0.0 y 0}
}
do_test misc1-12.7 {
execsql {
CREATE TABLE t7(x INTEGER, y TEXT, z);

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.23 2006/01/14 08:02:28 danielk1977 Exp $
# $Id: misc2.test,v 1.24 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -257,7 +257,7 @@ ifcapable tempdb {
#
# The SQL code below was causing a segfault.
#
ifcapable subquery {
ifcapable subquery&&trigger {
do_test misc2-10.1 {
execsql {
CREATE TABLE t1229(x);

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.10 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: misc5.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -43,22 +43,46 @@ for {set i 120} {$i<140} {incr i} {
# Make sure large integers are stored correctly.
#
do_test misc5-2.1 {
execsql {
create table t2(x unique);
insert into t2 values(1);
insert or ignore into t2 select x*2 from t2;
insert or ignore into t2 select x*4 from t2;
insert or ignore into t2 select x*16 from t2;
insert or ignore into t2 select x*256 from t2;
insert or ignore into t2 select x*65536 from t2;
insert or ignore into t2 select x*2147483648 from t2;
insert or ignore into t2 select x-1 from t2;
insert or ignore into t2 select x+1 from t2;
insert or ignore into t2 select -x from t2;
select count(*) from t2;
}
} 371
ifcapable conflict {
do_test misc5-2.1 {
execsql {
create table t2(x unique);
insert into t2 values(1);
insert or ignore into t2 select x*2 from t2;
insert or ignore into t2 select x*4 from t2;
insert or ignore into t2 select x*16 from t2;
insert or ignore into t2 select x*256 from t2;
insert or ignore into t2 select x*65536 from t2;
insert or ignore into t2 select x*2147483648 from t2;
insert or ignore into t2 select x-1 from t2;
insert or ignore into t2 select x+1 from t2;
insert or ignore into t2 select -x from t2;
select count(*) from t2;
}
} 371
} else {
do_test misc5-2.1 {
execsql {
BEGIN;
create table t2(x unique);
create table t2_temp(x);
insert into t2_temp values(1);
insert into t2_temp select x*2 from t2_temp;
insert into t2_temp select x*4 from t2_temp;
insert into t2_temp select x*16 from t2_temp;
insert into t2_temp select x*256 from t2_temp;
insert into t2_temp select x*65536 from t2_temp;
insert into t2_temp select x*2147483648 from t2_temp;
insert into t2_temp select x-1 from t2_temp;
insert into t2_temp select x+1 from t2_temp;
insert into t2_temp select -x from t2_temp;
INSERT INTO t2 SELECT DISTINCT(x) FROM t2_temp;
DROP TABLE t2_temp;
COMMIT;
select count(*) from t2;
}
} 371
}
do_test misc5-2.2 {
execsql {
select x from t2 order by x;

View File

@ -12,11 +12,16 @@
#
# This file implements tests for the NOT NULL constraint.
#
# $Id: notnull.test,v 1.3 2003/01/29 18:46:54 drh Exp $
# $Id: notnull.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !conflict {
finish_test
return
}
do_test notnull-1.0 {
execsql {
CREATE TABLE t1 (

View File

@ -162,26 +162,28 @@ do_test null-6.1 {
# The UNIQUE constraint only applies to non-null values
#
ifcapable conflict {
do_test null-7.1 {
execsql {
create table t2(a, b unique on conflict ignore);
insert into t2 values(1,1);
insert into t2 values(2,null);
insert into t2 values(3,null);
insert into t2 values(4,1);
select a from t2;
}
} {1 2 3}
do_test null-7.2 {
execsql {
create table t3(a, b, c, unique(b,c) on conflict ignore);
insert into t3 values(1,1,1);
insert into t3 values(2,null,1);
insert into t3 values(3,null,1);
insert into t3 values(4,1,1);
select a from t3;
}
} {1 2 3}
execsql {
create table t2(a, b unique on conflict ignore);
insert into t2 values(1,1);
insert into t2 values(2,null);
insert into t2 values(3,null);
insert into t2 values(4,1);
select a from t2;
}
} {1 2 3}
do_test null-7.2 {
execsql {
create table t3(a, b, c, unique(b,c) on conflict ignore);
insert into t3 values(1,1,1);
insert into t3 values(2,null,1);
insert into t3 values(3,null,1);
insert into t3 values(4,1,1);
select a from t3;
}
} {1 2 3}
}
# Ticket #461 - Make sure nulls are handled correctly when doing a
# lookup using an index.

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.10 2005/05/20 20:01:56 drh Exp $
# $Id: pagesize.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
@ -75,12 +75,14 @@ do_test pagesize-1.8 {
} 8192
foreach PGSZ {512 2048 4096 8192} {
do_test pagesize-2.$PGSZ.0 {
db close
sqlite3 db :memory:
execsql "PRAGMA page_size=$PGSZ;"
execsql {PRAGMA page_size}
} 1024
ifcapable memorydb {
do_test pagesize-2.$PGSZ.0 {
db close
sqlite3 db :memory:
execsql "PRAGMA page_size=$PGSZ;"
execsql {PRAGMA page_size}
} 1024
}
do_test pagesize-2.$PGSZ.1 {
db close
file delete -force test.db

View File

@ -13,7 +13,7 @@
# caused by an ON CONFLICT ROLLBACK clause aborts any other pending
# statements.
#
# $Id: rollback.test,v 1.3 2006/01/03 00:33:50 drh Exp $
# $Id: rollback.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -31,33 +31,37 @@ do_test rollback-1.1 {
}
} {1 2 3 4}
do_test rollback-1.2 {
execsql {
CREATE TABLE t3(a unique on conflict rollback);
INSERT INTO t3 SELECT a FROM t1;
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
}
} {}
ifcapable conflict {
do_test rollback-1.2 {
execsql {
CREATE TABLE t3(a unique on conflict rollback);
INSERT INTO t3 SELECT a FROM t1;
BEGIN;
INSERT INTO t1 SELECT * FROM t1;
}
} {}
}
do_test rollback-1.3 {
set STMT [sqlite3_prepare $DB "SELECT a FROM t1" -1 TAIL]
sqlite3_step $STMT
} {SQLITE_ROW}
# This causes a ROLLBACK, which deletes the table out from underneath the
# SELECT statement.
#
do_test rollback-1.4 {
catchsql {
INSERT INTO t3 SELECT a FROM t1;
}
} {1 {column a is not unique}}
# Try to continue with the SELECT statement
#
do_test rollback-1.5 {
sqlite3_step $STMT
} {SQLITE_ABORT}
ifcapable conflict {
# This causes a ROLLBACK, which deletes the table out from underneath the
# SELECT statement.
#
do_test rollback-1.4 {
catchsql {
INSERT INTO t3 SELECT a FROM t1;
}
} {1 {column a is not unique}}
# Try to continue with the SELECT statement
#
do_test rollback-1.5 {
sqlite3_step $STMT
} {SQLITE_ABORT}
}
# Restart the SELECT statement
#

View File

@ -9,7 +9,7 @@
#
#***********************************************************************
#
# $Id: shared.test,v 1.16 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: shared.test,v 1.17 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -213,7 +213,7 @@ do_test shared-$av.3.1.1 {
if {$i < 4} {
set max [execsql {SELECT max(i) FROM seq}]
db eval {
INSERT INTO seq SELECT i + $max, x FROM seq;
INSERT INTO seq SELECT i + :max, x FROM seq;
}
}
lappend ret $i
@ -227,7 +227,7 @@ do_test shared-$av.3.1.2 {
# (test 3.1.3 verifies this).
set ret [list]
db2 eval {SELECT i FROM seq} {
db eval {DELETE FROM seq WHERE i = $i}
db eval {DELETE FROM seq WHERE i = :i}
lappend ret $i
}
set ret
@ -412,20 +412,50 @@ do_test shared-$av.5.1.2 {
execsql {
CREATE TABLE test1.t1(a, b);
CREATE INDEX test1.i1 ON t1(a, b);
CREATE VIEW test1.v1 AS SELECT * FROM t1;
CREATE TRIGGER test1.trig1 AFTER INSERT ON t1 BEGIN
INSERT INTO t1 VALUES(new.a, new.b);
END;
} db1
} {}
ifcapable view {
do_test shared-$av.5.1.3 {
execsql {
CREATE VIEW test1.v1 AS SELECT * FROM t1;
} db1
} {}
}
ifcapable trigger {
do_test shared-$av.5.1.4 {
execsql {
CREATE TRIGGER test1.trig1 AFTER INSERT ON t1 BEGIN
INSERT INTO t1 VALUES(new.a, new.b);
END;
} db1
} {}
}
do_test shared-$av.5.1.5 {
execsql {
DROP INDEX i1;
DROP VIEW v1;
DROP TRIGGER trig1;
} db2
} {}
ifcapable view {
do_test shared-$av.5.1.6 {
execsql {
DROP VIEW v1;
} db2
} {}
}
ifcapable trigger {
do_test shared-$av.5.1.7 {
execsql {
DROP TRIGGER trig1;
} db2
} {}
}
do_test shared-$av.5.1.8 {
execsql {
DROP TABLE t1;
} db2
} {}
ifcapable compound {
do_test shared-$av.5.1.2 {
do_test shared-$av.5.1.9 {
execsql {
SELECT * FROM sqlite_master UNION ALL SELECT * FROM test1.sqlite_master
} db1
@ -518,7 +548,7 @@ do_test shared-$av.7.1 {
set a [string repeat "$i " 20]
set b [string repeat "$i " 20]
db eval {
INSERT INTO t1 VALUES($a, $b);
INSERT INTO t1 VALUES(:a, :b);
}
lappend ::contents [list [expr $i+1] $a $b]
}
@ -580,54 +610,56 @@ unset -nocomplain contents
# the wrong encoding for a database.
#
file delete -force test.db test.db-journal
do_test shared-$av.8.1.1 {
sqlite3 db test.db
execsql {
PRAGMA encoding = 'UTF-16';
SELECT * FROM sqlite_master;
}
} {}
do_test shared-$av.8.1.2 {
string range [execsql {PRAGMA encoding;}] 0 end-2
} {UTF-16}
do_test shared-$av.8.1.3 {
sqlite3 db2 test.db
execsql {
PRAGMA encoding = 'UTF-8';
CREATE TABLE abc(a, b, c);
} db2
} {}
do_test shared-$av.8.1.4 {
execsql {
SELECT * FROM sqlite_master;
}
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test shared-$av.8.1.5 {
db2 close
execsql {
PRAGMA encoding;
}
} {UTF-8}
file delete -force test2.db test2.db-journal
do_test shared-$av.8.2.1 {
execsql {
ATTACH 'test2.db' AS aux;
SELECT * FROM aux.sqlite_master;
}
} {}
do_test shared-$av.8.2.2 {
sqlite3 db2 test2.db
execsql {
PRAGMA encoding = 'UTF-16';
CREATE TABLE def(d, e, f);
} db2
string range [execsql {PRAGMA encoding;} db2] 0 end-2
} {UTF-16}
do_test shared-$av.8.2.3 {
catchsql {
SELECT * FROM aux.sqlite_master;
}
} {1 {attached databases must use the same text encoding as main database}}
ifcapable utf16 {
do_test shared-$av.8.1.1 {
sqlite3 db test.db
execsql {
PRAGMA encoding = 'UTF-16';
SELECT * FROM sqlite_master;
}
} {}
do_test shared-$av.8.1.2 {
string range [execsql {PRAGMA encoding;}] 0 end-2
} {UTF-16}
do_test shared-$av.8.1.3 {
sqlite3 db2 test.db
execsql {
PRAGMA encoding = 'UTF-8';
CREATE TABLE abc(a, b, c);
} db2
} {}
do_test shared-$av.8.1.4 {
execsql {
SELECT * FROM sqlite_master;
}
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test shared-$av.8.1.5 {
db2 close
execsql {
PRAGMA encoding;
}
} {UTF-8}
file delete -force test2.db test2.db-journal
do_test shared-$av.8.2.1 {
execsql {
ATTACH 'test2.db' AS aux;
SELECT * FROM aux.sqlite_master;
}
} {}
do_test shared-$av.8.2.2 {
sqlite3 db2 test2.db
execsql {
PRAGMA encoding = 'UTF-16';
CREATE TABLE def(d, e, f);
} db2
string range [execsql {PRAGMA encoding;} db2] 0 end-2
} {UTF-16}
do_test shared-$av.8.2.3 {
catchsql {
SELECT * FROM aux.sqlite_master;
}
} {1 {attached databases must use the same text encoding as main database}}
}
catch {db close}
catch {db2 close}

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is testing correlated subqueries
#
# $Id: subquery.test,v 1.13 2005/09/08 10:37:01 drh Exp $
# $Id: subquery.test,v 1.14 2006/01/17 09:35:02 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -269,6 +269,15 @@ ifcapable view {
SELECT * FROM v1 WHERE EXISTS(SELECT * FROM t2 WHERE p=v1.b);
}
} {2}
} else {
catchsql { DROP TABLE t1; }
catchsql { DROP TABLE t2; }
execsql {
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2);
CREATE TABLE t2(p,q);
INSERT INTO t2 VALUES(2,9);
}
}
# Ticket 1084

View File

@ -13,7 +13,7 @@
# This file implements tests to verify that fsync is disabled when
# pragma synchronous=off even for multi-database commits.
#
# $Id: sync.test,v 1.2 2005/11/25 10:38:22 danielk1977 Exp $
# $Id: sync.test,v 1.3 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -43,21 +43,23 @@ do_test sync-1.1 {
}
set sqlite_sync_count
} 8
do_test sync-1.2 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=on;
PRAGMA db2.synchronous=on;
BEGIN;
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(3,4);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 8
ifcapable pager_pragmas {
do_test sync-1.2 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=on;
PRAGMA db2.synchronous=on;
BEGIN;
INSERT INTO t1 VALUES(1,2);
INSERT INTO t2 VALUES(3,4);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 8
}
do_test sync-1.3 {
set sqlite_sync_count 0
execsql {
@ -73,18 +75,20 @@ do_test sync-1.3 {
}
set sqlite_sync_count
} 10
do_test sync-1.4 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=off;
PRAGMA db2.synchronous=off;
BEGIN;
INSERT INTO t1 VALUES(5,6);
INSERT INTO t2 VALUES(7,8);
COMMIT;
}
set sqlite_sync_count
} 0
ifcapable pager_pragmas {
do_test sync-1.4 {
set sqlite_sync_count 0
execsql {
PRAGMA main.synchronous=off;
PRAGMA db2.synchronous=off;
BEGIN;
INSERT INTO t1 VALUES(5,6);
INSERT INTO t2 VALUES(7,8);
COMMIT;
}
set sqlite_sync_count
} 0
}
finish_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.49 2006/01/05 15:50:07 drh Exp $
# $Id: tclsqlite.test,v 1.50 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -335,18 +335,20 @@ do_test tcl-9.3 {
# Recursive calls to the same user-defined function
#
do_test tcl-9.10 {
proc userfunc_r1 {n} {
if {$n<=0} {return 0}
set nm1 [expr {$n-1}]
return [expr {[db eval {SELECT r1($nm1)}]+$n}]
}
db function r1 userfunc_r1
execsql {SELECT r1(10)}
} {55}
do_test tcl-9.11 {
execsql {SELECT r1(100)}
} {5050}
ifcapable tclvar {
do_test tcl-9.10 {
proc userfunc_r1 {n} {
if {$n<=0} {return 0}
set nm1 [expr {$n-1}]
return [expr {[db eval {SELECT r1($nm1)}]+$n}]
}
db function r1 userfunc_r1
execsql {SELECT r1(10)}
} {55}
do_test tcl-9.11 {
execsql {SELECT r1(100)}
} {5050}
}
# Tests for the new transaction method
#

View File

@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.60 2006/01/16 12:46:41 danielk1977 Exp $
# $Id: tester.tcl,v 1.61 2006/01/17 09:35:02 danielk1977 Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not.
@ -178,7 +178,7 @@ proc finalize_testing {} {
#
proc execsql {sql {db db}} {
# puts "SQL = $sql"
return [$db eval $sql]
uplevel [list $db eval $sql]
}
# Execute SQL and catch exceptions.

View File

@ -14,11 +14,15 @@
# fixed.
#
#
# $Id: tkt1435.test,v 1.1 2005/09/17 13:29:24 drh Exp $
# $Id: tkt1435.test,v 1.2 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !memorydb {
finish_test
return
}
# Construct the sample database.
#

View File

@ -34,12 +34,12 @@
# name be the time I noticed the error. With CVS it is a really hassle
# to change filenames, so I'll just leave it as is. No harm done.
#
# $Id: tkt1443.test,v 1.3 2006/01/14 08:02:29 danielk1977 Exp $
# $Id: tkt1443.test,v 1.4 2006/01/17 09:35:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !subquery {
ifcapable !subquery||!memorydb {
finish_test
return
}

View File

@ -17,7 +17,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable compound {
ifcapable !compound||!view {
finish_test
return
}

View File

@ -17,9 +17,10 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Somewhere in tkt1449-1.1 is a VIEW definition that uses a subquery.
# So we cannot run this file if subqueries are not available.
ifcapable !subquery {
# Somewhere in tkt1449-1.1 is a VIEW definition that uses a subquery and
# a compound SELECT. So we cannot run this file if any of these features
# are not available.
ifcapable !subquery||!compound||!view {
finish_test
return
}

View File

@ -17,7 +17,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable compound {
ifcapable !compound {
finish_test
return
}

View File

@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !compound {
finish_test
return
}
do_test tkt1501-1.1 {
execsql {
CREATE TABLE t1(a,b);

View File

@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !vacuum {
finish_test
return
}
do_test tkt1512-1.1 {
execsql {
CREATE TABLE t1(a,b);

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
# $Id: trans.test,v 1.27 2005/12/30 16:28:02 danielk1977 Exp $
# $Id: trans.test,v 1.28 2006/01/17 09:35:03 danielk1977 Exp $
set testdir [file dirname $argv0]
@ -896,9 +896,15 @@ for {set i 2} {$i<=$limit} {incr i} {
do_test trans-9.$i.4-$cnt {
expr {$sqlite_sync_count>0}
} 1
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
ifcapable pager_pragmas {
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} [expr {$i%2==0}]
} else {
do_test trans-9.$i.5-$cnt {
expr {$sqlite_fullsync_count>0}
} {1}
}
}
}
set ::pager_old_format 0

View File

@ -442,54 +442,54 @@ do_test trigger1-8.6 {
}
} {}
# Make sure REPLACE works inside of triggers.
#
# There are two versions of trigger-9.1 and trigger-9.2. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
ifcapable conflict {
# Make sure REPLACE works inside of triggers.
#
# There are two versions of trigger-9.1 and trigger-9.2. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
} else {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
DROP TABLE t3;
DROP TABLE t4;
}
} {1 2 1 3 99 99 1 3}
}
ifcapable !compound {
do_test trigger1-9.1 {
execsql {
CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b);
CREATE TRIGGER r34 AFTER INSERT ON t3 BEGIN
REPLACE INTO t4 VALUES(new.a,new.b);
END;
INSERT INTO t3 VALUES(1,2);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 99 99 1 2}
do_test trigger1-9.2 {
execsql {
INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
}
} {1 2 1 3 99 99 1 3}
}
execsql {
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
}
# Ticket #764. At one stage TEMP triggers would fail to re-install when the
# schema was reloaded. The following tests ensure that TEMP triggers are

View File

@ -473,119 +473,121 @@ execsql {
DROP TABLE tbl;
}
# Handling of ON CONFLICT by INSERT statements inside triggers
execsql {
CREATE TABLE tbl (a primary key, b, c);
CREATE TRIGGER ai_tbl AFTER INSERT ON tbl BEGIN
INSERT OR IGNORE INTO tbl values (new.a, 0, 0);
END;
}
do_test trigger2-6.1a {
ifcapable conflict {
# Handling of ON CONFLICT by INSERT statements inside triggers
execsql {
BEGIN;
INSERT INTO tbl values (1, 2, 3);
SELECT * from tbl;
CREATE TABLE tbl (a primary key, b, c);
CREATE TRIGGER ai_tbl AFTER INSERT ON tbl BEGIN
INSERT OR IGNORE INTO tbl values (new.a, 0, 0);
END;
}
} {1 2 3}
do_test trigger2-6.1b {
catchsql {
INSERT OR ABORT INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1c {
do_test trigger2-6.1a {
execsql {
BEGIN;
INSERT INTO tbl values (1, 2, 3);
SELECT * from tbl;
}
} {1 2 3}
do_test trigger2-6.1b {
catchsql {
INSERT OR ABORT INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1c {
execsql {
SELECT * from tbl;
}
} {1 2 3}
do_test trigger2-6.1d {
catchsql {
INSERT OR FAIL INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1e {
execsql {
SELECT * from tbl;
}
} {1 2 3 2 2 3}
do_test trigger2-6.1f {
execsql {
INSERT OR REPLACE INTO tbl values (2, 2, 3);
SELECT * from tbl;
}
} {1 2 3 2 0 0}
do_test trigger2-6.1g {
catchsql {
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1h {
execsql {
SELECT * from tbl;
}
} {}
execsql {DELETE FROM tbl}
# Handling of ON CONFLICT by UPDATE statements inside triggers
execsql {
SELECT * from tbl;
INSERT INTO tbl values (4, 2, 3);
INSERT INTO tbl values (6, 3, 4);
CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN
UPDATE OR IGNORE tbl SET a = new.a, c = 10;
END;
}
} {1 2 3}
do_test trigger2-6.1d {
catchsql {
INSERT OR FAIL INTO tbl values (2, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1e {
do_test trigger2-6.2a {
execsql {
BEGIN;
UPDATE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2b {
catchsql {
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2c {
execsql {
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2d {
catchsql {
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2e {
execsql {
SELECT * from tbl;
}
} {4 2 10 6 3 4}
do_test trigger2-6.2f.1 {
execsql {
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 3 10}
do_test trigger2-6.2f.2 {
execsql {
INSERT INTO tbl VALUES (2, 3, 4);
SELECT * FROM tbl;
}
} {1 3 10 2 3 4}
do_test trigger2-6.2g {
catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2h {
execsql {
SELECT * from tbl;
}
} {4 2 3 6 3 4}
execsql {
SELECT * from tbl;
DROP TABLE tbl;
}
} {1 2 3 2 2 3}
do_test trigger2-6.1f {
execsql {
INSERT OR REPLACE INTO tbl values (2, 2, 3);
SELECT * from tbl;
}
} {1 2 3 2 0 0}
do_test trigger2-6.1g {
catchsql {
INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
}
} {1 {column a is not unique}}
do_test trigger2-6.1h {
execsql {
SELECT * from tbl;
}
} {}
execsql {DELETE FROM tbl}
# Handling of ON CONFLICT by UPDATE statements inside triggers
execsql {
INSERT INTO tbl values (4, 2, 3);
INSERT INTO tbl values (6, 3, 4);
CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN
UPDATE OR IGNORE tbl SET a = new.a, c = 10;
END;
}
do_test trigger2-6.2a {
execsql {
BEGIN;
UPDATE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2b {
catchsql {
UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2c {
execsql {
SELECT * from tbl;
}
} {1 2 10 6 3 4}
do_test trigger2-6.2d {
catchsql {
UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2e {
execsql {
SELECT * from tbl;
}
} {4 2 10 6 3 4}
do_test trigger2-6.2f.1 {
execsql {
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl;
}
} {1 3 10}
do_test trigger2-6.2f.2 {
execsql {
INSERT INTO tbl VALUES (2, 3, 4);
SELECT * FROM tbl;
}
} {1 3 10 2 3 4}
do_test trigger2-6.2g {
catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
}
} {1 {column a is not unique}}
do_test trigger2-6.2h {
execsql {
SELECT * from tbl;
}
} {4 2 3 6 3 4}
execsql {
DROP TABLE tbl;
}
} ; # ifcapable conflict
# 7. Triggers on views
ifcapable view {

View File

@ -12,7 +12,7 @@
# of this file is testing the interaction of SQLite manifest types
# with Tcl dual-representations.
#
# $Id: types3.test,v 1.4 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: types3.test,v 1.5 2006/01/17 09:35:03 danielk1977 Exp $
#
set testdir [file dirname $argv0]
@ -22,23 +22,23 @@ source $testdir/tester.tcl
do_test types3-1.1 {
set V {}
append V {}
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {string text}
# A variable with an integer representation comes in as INTEGER
do_test types3-1.2 {
set V [expr {1+2}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {int integer}
do_test types3-1.3 {
set V [expr {1+123456789012345}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {wideInt integer}
# A double variable comes in as REAL
do_test types3-1.4 {
set V [expr {1.0+1}]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {double real}
# A byte-array variable comes in a BLOB if it has no string representation
@ -46,12 +46,12 @@ do_test types3-1.4 {
#
do_test types3-1.5 {
set V [binary format a3 abc]
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {bytearray blob}
do_test types3-1.6 {
set V "abc"
binary scan $V a3 x
concat [tcl_variable_type V] [execsql {SELECT typeof($::V)}]
concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
} {bytearray text}
# Check to make sure return values are of the right types.

View File

@ -12,7 +12,7 @@
# focus of this file is testing the use of indices in WHERE clauses
# based on recent changes to the optimizer.
#
# $Id: where2.test,v 1.7 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: where2.test,v 1.8 2006/01/17 09:35:03 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -29,7 +29,11 @@ do_test where2-1.0 {
set x [expr {int(log($i)/log(2))}]
set y [expr {$i*$i + 2*$i + 1}]
set z [expr {$x+$y}]
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
ifcapable tclvar {
execsql {INSERT INTO t1 VALUES($::w,$::x,$::y,$::z)}
} else {
execsql {INSERT INTO t1 VALUES(:w,:x,:y,:z)}
}
}
execsql {
CREATE UNIQUE INDEX i1w ON t1(w);