1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Modify test suite to work when SQLITE_OMIT_VIEW is defined. (CVS 2132)

FossilOrigin-Name: 711e8d7695dfc74b3f1ee00591dcdda2cd7fc7d5
This commit is contained in:
danielk1977
2004-11-22 08:43:32 +00:00
parent 03aded4924
commit 0fa8ddbdec
20 changed files with 135 additions and 46 deletions

View File

@ -1,5 +1,5 @@
C Have\stests\spass\swhen\sSQLITE_OMIT_MEMORYDB\sis\sdefined.\s(CVS\s2131) C Modify\stest\ssuite\sto\swork\swhen\sSQLITE_OMIT_VIEW\sis\sdefined.\s(CVS\s2132)
D 2004-11-22T05:26:27 D 2004-11-22T08:43:32
F Makefile.in 8291610f5839939a5fbff4dbbf85adb0fe1ac37f F Makefile.in 8291610f5839939a5fbff4dbbf85adb0fe1ac37f
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@ -84,10 +84,10 @@ F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0
F src/where.c 4d28167e450255372b45abf1bc8cd5f0e9264d7b F src/where.c 4d28167e450255372b45abf1bc8cd5f0e9264d7b
F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
F test/alter.test 2b4478c4906e4d1504b1a121b4ffbc8d11043b53 F test/alter.test 2b4478c4906e4d1504b1a121b4ffbc8d11043b53
F test/attach.test e305dd59a375e37c658c6d401f19f8a95880bf9a F test/attach.test bb0ff048b0a65ca2bd5f186eee05d2ec084f3972
F test/attach2.test 399128a7b3b209a339a8dbf53ca2ed42eb982d1a F test/attach2.test 399128a7b3b209a339a8dbf53ca2ed42eb982d1a
F test/attach3.test 8a0309e284cf9aa1d7d6cc444989031881f7a21c F test/attach3.test c05c70b933afbde0901dab9da3e66ee842c09f38
F test/auth.test 6dd796db7481d9dfde52e455f6b3d2cd7891b888 F test/auth.test 38a0546692931383a5ef4f762c4202a48160df0a
F test/autoinc.test 11330758197e0301d3600a071230d45b2f6a65b7 F test/autoinc.test 11330758197e0301d3600a071230d45b2f6a65b7
F test/autovacuum.test a4e8da39a6268378c4f9fc17fe2df1d5be16d631 F test/autovacuum.test a4e8da39a6268378c4f9fc17fe2df1d5be16d631
F test/autovacuum_crash.test 2dca85cbcc497098e45e8847c86407eb3554f3d4 F test/autovacuum_crash.test 2dca85cbcc497098e45e8847c86407eb3554f3d4
@ -107,7 +107,7 @@ F test/capi3.test c53e4eea686dacad8a1239c0d584fe63e6e601dc
F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336 F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03 F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036 F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036
F test/collate3.test ef53bf9323ebae7c75b6411e62a227dda81b9f7b F test/collate3.test cf747926374285c1690e3294a1abcb83d6f15529
F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b
F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5 F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
@ -127,19 +127,19 @@ F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05 F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
F test/index.test 5776a3ebcbe0bdc69e7eeaeb5e95dfba6b17389e F test/index.test 1294997b4743007af57f8148c63ba14f07ad31ab
F test/insert.test 56f9c20c9adc8d707490c4ffa5d4daa94826ea03 F test/insert.test 56f9c20c9adc8d707490c4ffa5d4daa94826ea03
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
F test/interrupt.test 0aa230f8aedec0ad7caaf5edaced337e4cfb3820 F test/interrupt.test 0aa230f8aedec0ad7caaf5edaced337e4cfb3820
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194 F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c
F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd F test/join.test 4bee854ef752619df9db2184eafe2f3a1561f74c
F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8 F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3 F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
F test/lastinsert.test 09ac3a359ced3d4510feccc0dcbae3d80e449cf9 F test/lastinsert.test b6a1db3e1ce2d3f0d6afe99d445084f543b6feaa
F test/laststmtchanges.test 9cb56c5935103cacd0070d9d25d8dde322928db1 F test/laststmtchanges.test 07cbdabc52407c29e40abc25050f2434f044a6b1
F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35 F test/limit.test 4798e0196186e4c9b0f3ce90c1efd196877a1d17
F test/lock.test ba72c211499b0874c56643b9ede1df4018bb20de F test/lock.test ba72c211499b0874c56643b9ede1df4018bb20de
F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
@ -150,7 +150,7 @@ F test/memdb.test c9ccd02cd9ce9d2cdcd5a712efecf24e7b93b7fa
F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29 F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29
F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6 F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6
F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a
F test/misc2.test 53cf5e931547962563df3600f85ba49e86ffa1fe F test/misc2.test 851e63fcc849b0c155cb02eb06537ea93b7f24b2
F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94 F test/misc3.test 928a2f1e1189924ed14e1ae074e34f40688bdf94
F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622 F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622
F test/misuse.test 2d7c46160f7c214f761fc5d030684a37ae8832a6 F test/misuse.test 2d7c46160f7c214f761fc5d030684a37ae8832a6
@ -174,8 +174,8 @@ F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2 F test/select4.test 86e72fc3b07de4fe11439aa419e37db3c49467e2
F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5 F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5
F test/select6.test 4ce9fa563662d5b2f5a8ff57e4d8b2f5cd186d38 F test/select6.test 4ce9fa563662d5b2f5a8ff57e4d8b2f5cd186d38
F test/select7.test c71c822a82c80bbd55558b4b69d35442dfe22ffd F test/select7.test 9dc9aaa403b14689e2cb9912c8f15e5ae8d104f7
F test/sort.test c97c1a3289337b1dc349ac8a59e0780d2dcfd90b F test/sort.test 03e16f0c4d7fe7b7d87893db0cab3b399b8f2cb1
F test/subselect.test 50f98723f00e97b1839d36410ee63597ca82d775 F test/subselect.test 50f98723f00e97b1839d36410ee63597ca82d775
F test/table.test 87a6219c784722249a2f604b6495ce171ca2588a F test/table.test 87a6219c784722249a2f604b6495ce171ca2588a
F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede F test/tableapi.test b21ab097e87a5484bb61029e69e1a4e5c5e65ede
@ -187,19 +187,19 @@ F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b F test/threadtest2.c 97a830d53c24c42290501fdfba4a6e5bdd34748b
F test/trace.test a54fa8df0d01cf827289a7659d78959e8fd2f955 F test/trace.test a54fa8df0d01cf827289a7659d78959e8fd2f955
F test/trans.test 29645b344d2b9b6792793562b12340177ddd8f96 F test/trans.test 29645b344d2b9b6792793562b12340177ddd8f96
F test/trigger1.test 63a74ae12bccac86036f1c4f8f952fb0cf80703f F test/trigger1.test 5fd454a431bae6cf75783ab539c4e65802c244fa
F test/trigger2.test cbf5da84a2413380644bde3fef94943ee103ea4e F test/trigger2.test 534390be509127859fee7c23018f03b9bf21a88f
F test/trigger3.test f1c0cc1365f00b21a8cd41c189edca139c2d6cc6 F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2
F test/trigger4.test ce5c97aba6a8a11be5820e694659438c3e982ada F test/trigger4.test e7c0812b14750754602468f15495260e8c6625e0
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
F test/types.test f0a98d10c5ecc9865d19dc94486f9873afc6bb6b F test/types.test f0a98d10c5ecc9865d19dc94486f9873afc6bb6b
F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7 F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217 F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558 F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
F test/vacuum.test 5b9dfaa2f33f0a694d249e45e0c39776bcd380c3 F test/vacuum.test 7d9eb0d4398cd326d14ee8673509a8565030467c
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 2ec8fd4f3809243ad12667932071d536d1ba6850 F test/view.test a68bee7f5b4e33656667cbf4748dcfc5ebe1828b
F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 250b30bcf3f1f422a2cad24b1597314777058a4b F tool/lemon.c 250b30bcf3f1f422a2cad24b1597314777058a4b
@ -261,7 +261,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P 27a8379b54d6a1169b89e540ba44f4f94d006fb7 P 9df837c03939cdcb31856ac17b2425a6dd92d7b2
R 6a5416a0cd0513fbaa34b706145b6710 R 58a8d6a23d66b3c503089009ebe0b762
U danielk1977 U danielk1977
Z ccc4b0691f08930c772208bba7abaacc Z 2746b3ff0377ed15d41d60a317d903c0

View File

@ -1 +1 @@
9df837c03939cdcb31856ac17b2425a6dd92d7b2 711e8d7695dfc74b3f1ee00591dcdda2cd7fc7d5

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands # focus of this script is testing the ATTACH and DETACH commands
# and related functionality. # and related functionality.
# #
# $Id: attach.test,v 1.29 2004/11/04 14:47:13 drh Exp $ # $Id: attach.test,v 1.30 2004/11/22 08:43:32 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -520,6 +520,8 @@ do_test attach-4.9 {
SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4; SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4;
} }
} {db2.6 db2.13 main.11 main.15} } {db2.6 db2.13 main.11 main.15}
ifcapable view {
do_test attach-4.10 { do_test attach-4.10 {
execsql { execsql {
DETACH DATABASE db2; DETACH DATABASE db2;
@ -546,6 +548,7 @@ do_test attach-4.13 {
SELECT * FROM main.v3; SELECT * FROM main.v3;
} }
} {910 1112 1516} } {910 1112 1516}
} ;# ifcapable view
# Tests for the sqliteFix...() routines in attach.c # Tests for the sqliteFix...() routines in attach.c
# #

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands # focus of this script is testing the ATTACH and DETACH commands
# and schema changes to attached databases. # and schema changes to attached databases.
# #
# $Id: attach3.test,v 1.13 2004/11/10 15:27:38 danielk1977 Exp $ # $Id: attach3.test,v 1.14 2004/11/22 08:43:32 danielk1977 Exp $
# #
@ -122,6 +122,7 @@ do_test attach3-4.3 {
} {t3} } {t3}
# Create a view in the auxilary database. # Create a view in the auxilary database.
ifcapable view {
do_test attach3-5.1 { do_test attach3-5.1 {
execsql { execsql {
CREATE VIEW aux.v1 AS SELECT * FROM t3; CREATE VIEW aux.v1 AS SELECT * FROM t3;
@ -150,6 +151,7 @@ do_test attach3-6.2 {
SELECT * FROM aux.sqlite_master WHERE name = 'v1'; SELECT * FROM aux.sqlite_master WHERE name = 'v1';
} }
} {} } {}
} ;# ifcapable view
ifcapable {trigger} { ifcapable {trigger} {
# Create a trigger in the auxilary database. # Create a trigger in the auxilary database.

View File

@ -12,7 +12,7 @@
# focus of this script is testing the ATTACH and DETACH commands # focus of this script is testing the ATTACH and DETACH commands
# and related functionality. # and related functionality.
# #
# $Id: auth.test,v 1.21 2004/11/22 03:34:21 danielk1977 Exp $ # $Id: auth.test,v 1.22 2004/11/22 08:43:32 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -538,6 +538,9 @@ do_test auth-1.78 {
execsql {SELECT name FROM sqlite_temp_master} execsql {SELECT name FROM sqlite_temp_master}
} {t1} } {t1}
# Test cases auth-1.79 to auth-1.123 test creating and dropping views.
# Omit these if the library was compiled with views omitted.
ifcapable view {
do_test auth-1.79 { do_test auth-1.79 {
proc auth {code arg1 arg2 arg3 arg4} { proc auth {code arg1 arg2 arg3 arg4} {
if {$code=="SQLITE_CREATE_VIEW"} { if {$code=="SQLITE_CREATE_VIEW"} {
@ -806,6 +809,7 @@ do_test auth-1.123 {
do_test auth-1.124 { do_test auth-1.124 {
execsql {SELECT name FROM sqlite_temp_master} execsql {SELECT name FROM sqlite_temp_master}
} {t1} } {t1}
} ;# ifcapable view
do_test auth-1.125 { do_test auth-1.125 {
proc auth {code arg1 arg2 arg3 arg4} { proc auth {code arg1 arg2 arg3 arg4} {
@ -1933,6 +1937,8 @@ do_test auth-4.1 {
SQLITE_READ t2 b main r1 \ SQLITE_READ t2 b main r1 \
SQLITE_READ t2 c main r1 \ SQLITE_READ t2 c main r1 \
SQLITE_READ t2 c main r1] SQLITE_READ t2 c main r1]
ifcapable view {
do_test auth-4.2 { do_test auth-4.2 {
execsql { execsql {
CREATE VIEW v1 AS SELECT a+b AS x FROM t2; CREATE VIEW v1 AS SELECT a+b AS x FROM t2;
@ -1981,4 +1987,6 @@ do_test auth-4.5 {
SQLITE_INSERT v1chng {} main r3 \ SQLITE_INSERT v1chng {} main r3 \
SQLITE_READ v1 x main r3] SQLITE_READ v1 x main r3]
} ;# ifcapable view
finish_test finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script is page cache subsystem. # focus of this script is page cache subsystem.
# #
# $Id: collate3.test,v 1.4 2004/11/04 14:47:13 drh Exp $ # $Id: collate3.test,v 1.5 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -311,6 +311,7 @@ proc numeric_compare {lhs rhs} {
# Check we can create a view that uses an explicit collation # Check we can create a view that uses an explicit collation
# sequence and then close and re-open the database. # sequence and then close and re-open the database.
ifcapable view {
do_test collate3-4.9 { do_test collate3-4.9 {
db collate user_defined numeric_compare db collate user_defined numeric_compare
execsql { execsql {
@ -341,6 +342,7 @@ do_test collate3-4.12 {
DROP TABLE collate3t1; DROP TABLE collate3t1;
} }
} {} } {}
} ;# ifcapable view
# #
# Test the collation factory. In the code, the "no such collation sequence" # Test the collation factory. In the code, the "no such collation sequence"

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement. # focus of this file is testing the CREATE INDEX statement.
# #
# $Id: index.test,v 1.35 2004/11/07 13:01:50 drh Exp $ # $Id: index.test,v 1.36 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -600,11 +600,13 @@ do_test index-18.2 {
CREATE INDEX sqlite_i1 ON t7(c); CREATE INDEX sqlite_i1 ON t7(c);
} }
} {1 {object name reserved for internal use: sqlite_i1}} } {1 {object name reserved for internal use: sqlite_i1}}
ifcapable view {
do_test index-18.3 { do_test index-18.3 {
catchsql { catchsql {
CREATE VIEW sqlite_v1 AS SELECT * FROM t7; CREATE VIEW sqlite_v1 AS SELECT * FROM t7;
} }
} {1 {object name reserved for internal use: sqlite_v1}} } {1 {object name reserved for internal use: sqlite_v1}}
} ;# ifcapable view
ifcapable {trigger} { ifcapable {trigger} {
do_test index-18.4 { do_test index-18.4 {
catchsql { catchsql {

View File

@ -12,7 +12,7 @@
# #
# This file implements tests for joins, including outer joins. # This file implements tests for joins, including outer joins.
# #
# $Id: join.test,v 1.11 2003/09/27 13:39:40 drh Exp $ # $Id: join.test,v 1.12 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -328,6 +328,7 @@ do_test join-7.1 {
# Make sure a left join where the right table is really a view that # Make sure a left join where the right table is really a view that
# is itself a join works right. Ticket #306. # is itself a join works right. Ticket #306.
# #
ifcapable view {
do_test join-8.1 { do_test join-8.1 {
execsql { execsql {
BEGIN; BEGIN;
@ -356,6 +357,7 @@ do_test join-8.3 {
SELECT * FROM v10_11 LEFT JOIN t9 ON( a=x ); SELECT * FROM v10_11 LEFT JOIN t9 ON( a=x );
} }
} {1 111 1 11 3 333 {} {}} } {1 111 1 11 3 333 {} {}}
} ;# ifcapable view
# Ticket #350 describes a scenario where LEFT OUTER JOIN does not # Ticket #350 describes a scenario where LEFT OUTER JOIN does not
# function correctly if the right table in the join is really # function correctly if the right table in the join is really
@ -381,6 +383,7 @@ do_test join-9.1 {
SELECT * FROM t12 NATURAL LEFT JOIN (SELECT * FROM t13 WHERE b>0); SELECT * FROM t12 NATURAL LEFT JOIN (SELECT * FROM t13 WHERE b>0);
} }
} {} } {}
ifcapable view {
do_test join-9.2 { do_test join-9.2 {
execsql { execsql {
CREATE VIEW v13 AS SELECT * FROM t13 WHERE b>0; CREATE VIEW v13 AS SELECT * FROM t13 WHERE b>0;
@ -389,5 +392,6 @@ do_test join-9.2 {
SELECT * FROM t12 NATURAL LEFT JOIN v13; SELECT * FROM t12 NATURAL LEFT JOIN v13;
} }
} {} } {}
} ;# ifcapable view
finish_test finish_test

View File

@ -53,13 +53,20 @@ do_test lastinsert-1.3 {
} {0 3} } {0 3}
# LIRID unchanged after create table/view statements # LIRID unchanged after create table/view statements
do_test lastinsert-1.4 { do_test lastinsert-1.4.1 {
catchsql { catchsql {
create table t2 (k integer primary key, val1, val2, val3); create table t2 (k integer primary key, val1, val2, val3);
select last_insert_rowid();
}
} {0 3}
ifcapable view {
do_test lastinsert-1.4.2 {
catchsql {
create view v as select * from t1; create view v as select * from t1;
select last_insert_rowid(); select last_insert_rowid();
} }
} {0 3} } {0 3}
} ;# ifcapable view
# All remaining tests involve triggers. Skip them if triggers are not # All remaining tests involve triggers. Skip them if triggers are not
# supported in this build. # supported in this build.
@ -148,7 +155,10 @@ do_test lastinsert-3.4 {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 4.x - tests with instead of insert trigger # 4.x - tests with instead of insert trigger
# These may not be run if either views or triggers were disabled at
# compile-time
ifcapable {view && trigger} {
# LIRID not changed after an insert into view containing an instead of trigger # LIRID not changed after an insert into view containing an instead of trigger
do_test lastinsert-4.1 { do_test lastinsert-4.1 {
catchsql { catchsql {
@ -184,15 +194,18 @@ do_test lastinsert-4.4 {
select val3 from t2; select val3 from t2;
} }
} {0 1030} } {0 1030}
} ;# ifcapable (view && trigger)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 5.x - tests with before delete trigger # 5.x - tests with before delete trigger
# LIRID not changed after a delete on a table containing a before trigger # LIRID not changed after a delete on a table containing a before trigger
do_test lastinsert-5.1 { do_test lastinsert-5.1 {
catchsql {
drop trigger r1; -- This was not created if views are disabled.
}
catchsql { catchsql {
delete from t2; delete from t2;
drop trigger r1;
create trigger r1 before delete on t1 for each row begin create trigger r1 before delete on t1 for each row begin
insert into t2 values (77, last_insert_rowid(), NULL, NULL); insert into t2 values (77, last_insert_rowid(), NULL, NULL);
update t2 set k=k+10, val2=100+last_insert_rowid(); update t2 set k=k+10, val2=100+last_insert_rowid();
@ -226,7 +239,9 @@ do_test lastinsert-5.4 {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 6.x - tests with instead of update trigger # 6.x - tests with instead of update trigger
# These tests may not run if either views or triggers are disabled.
ifcapable {view && trigger} {
# LIRID not changed after an update on a view containing an instead of trigger # LIRID not changed after an update on a view containing an instead of trigger
do_test lastinsert-6.1 { do_test lastinsert-6.1 {
catchsql { catchsql {
@ -262,10 +277,13 @@ do_test lastinsert-6.4 {
select val3 from t2; select val3 from t2;
} }
} {0 1032} } {0 1032}
} ;# ifcapable (view && trigger)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 7.x - complex tests with temporary tables and nested instead of triggers # 7.x - complex tests with temporary tables and nested instead of triggers
# These do not run if views or triggers are disabled.
ifcapable {trigger && view} {
do_test lastinsert-7.1 { do_test lastinsert-7.1 {
catchsql { catchsql {
drop table t1; drop table t2; drop trigger r1; drop table t1; drop table t2; drop trigger r1;
@ -323,4 +341,6 @@ do_test lastinsert-7.6 {
} }
} {0 1205} } {0 1205}
} ;# ifcapable (view && trigger)
finish_test finish_test

View File

@ -193,6 +193,9 @@ do_test laststmtchanges-4.3 {
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 5.x - complex tests with temporary tables and nested instead of triggers # 5.x - complex tests with temporary tables and nested instead of triggers
# These tests cannot run if the library does not have view support enabled.
ifcapable view {
do_test laststmtchanges-5.1 { do_test laststmtchanges-5.1 {
catchsql { catchsql {
@ -262,4 +265,6 @@ do_test laststmtchanges-5.5 {
} }
} {0 {0 1 0 3}} } {0 {0 1 0 3}}
} ;# ifcapable view
finish_test finish_test

View File

@ -12,7 +12,7 @@
# focus of this file is testing the LIMIT ... OFFSET ... clause # focus of this file is testing the LIMIT ... OFFSET ... clause
# of SELECT statements. # of SELECT statements.
# #
# $Id: limit.test,v 1.16 2004/08/20 18:34:20 drh Exp $ # $Id: limit.test,v 1.17 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -65,12 +65,14 @@ do_test limit-1.7 {
execsql {SELECT * FROM t1 AS a, t1 AS b ORDER BY a.x, b.x LIMIT 5 OFFSET 32} execsql {SELECT * FROM t1 AS a, t1 AS b ORDER BY a.x, b.x LIMIT 5 OFFSET 32}
} {1 5 0 5 1 5 1 5 1 5 2 5 1 5 3 5 1 5 4 5} } {1 5 0 5 1 5 1 5 1 5 2 5 1 5 3 5 1 5 4 5}
ifcapable view {
do_test limit-2.1 { do_test limit-2.1 {
execsql { execsql {
CREATE VIEW v1 AS SELECT * FROM t1 LIMIT 2; CREATE VIEW v1 AS SELECT * FROM t1 LIMIT 2;
SELECT count(*) FROM (SELECT * FROM v1); SELECT count(*) FROM (SELECT * FROM v1);
} }
} 2 } 2
} ;# ifcapable view
do_test limit-2.2 { do_test limit-2.2 {
execsql { execsql {
CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 2; CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 2;

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were # This file implements tests for miscellanous features that were
# left out of other test files. # left out of other test files.
# #
# $Id: misc2.test,v 1.14 2004/11/16 15:50:21 danielk1977 Exp $ # $Id: misc2.test,v 1.15 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -49,12 +49,14 @@ do_test misc2-2.1 {
SELECT rowid, * FROM (SELECT * FROM t1, t2); SELECT rowid, * FROM (SELECT * FROM t1, t2);
} }
} {{} 1 2 3 7 8 9} } {{} 1 2 3 7 8 9}
ifcapable view {
do_test misc2-2.2 { do_test misc2-2.2 {
execsql { execsql {
CREATE VIEW v1 AS SELECT * FROM t1, t2; CREATE VIEW v1 AS SELECT * FROM t1, t2;
SELECT rowid, * FROM v1; SELECT rowid, * FROM v1;
} }
} {{} 1 2 3 7 8 9} } {{} 1 2 3 7 8 9}
} ;# ifcapable view
# Check name binding precedence. Ticket #387 # Check name binding precedence. Ticket #387
# #
@ -106,6 +108,7 @@ do_test misc2-4.6 {
# using a call to sqliteSrcListDup(). Ticket #416. The following test # using a call to sqliteSrcListDup(). Ticket #416. The following test
# makes sure the problem has been fixed. # makes sure the problem has been fixed.
# #
ifcapable view {
do_test misc2-5.1 { do_test misc2-5.1 {
execsql { execsql {
CREATE TABLE x(a,b); CREATE TABLE x(a,b);
@ -116,6 +119,7 @@ do_test misc2-5.1 {
SELECT * from z; SELECT * from z;
} }
} {} } {}
}
# Make sure we can open a database with an empty filename. What this # Make sure we can open a database with an empty filename. What this
# does is store the database in a temporary file that is deleted when # does is store the database in a temporary file that is deleted when

View File

@ -10,7 +10,7 @@
# focus of this file is testing compute SELECT statements and nested # focus of this file is testing compute SELECT statements and nested
# views. # views.
# #
# $Id: select7.test,v 1.1 2004/08/29 16:25:04 drh Exp $ # $Id: select7.test,v 1.2 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -33,6 +33,7 @@ do_test select7-1.1 {
# Nested views do not handle * properly. Ticket #826. # Nested views do not handle * properly. Ticket #826.
# #
ifcapable view {
do_test select7-2.1 { do_test select7-2.1 {
execsql { execsql {
CREATE TABLE x(id integer primary key, a TEXT NULL); CREATE TABLE x(id integer primary key, a TEXT NULL);
@ -45,6 +46,7 @@ do_test select7-2.1 {
SELECT * FROM tv2; SELECT * FROM tv2;
} }
} {1 1} } {1 1}
} ;# ifcapable view
finish_test finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE TABLE statement. # focus of this file is testing the CREATE TABLE statement.
# #
# $Id: sort.test,v 1.16 2004/11/03 13:59:06 drh Exp $ # $Id: sort.test,v 1.17 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -281,6 +281,10 @@ do_test sort-7.2 {
SELECT b FROM t4 ORDER BY 1 SELECT b FROM t4 ORDER BY 1
} }
} {1 11 12 2} } {1 11 12 2}
# Omit tests sort-7.3 to sort-7.8 if view support was disabled at
# compilatation time.
ifcapable view {
do_test sort-7.3 { do_test sort-7.3 {
execsql { execsql {
CREATE VIEW v4 AS SELECT * FROM t4; CREATE VIEW v4 AS SELECT * FROM t4;
@ -312,6 +316,8 @@ do_test sort-7.8 {
SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1; SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1;
} }
} {1 11 12 2} } {1 11 12 2}
} ;# ifcapable view
#### Version 3 works differently here: #### Version 3 works differently here:
#do_test sort-7.9 { #do_test sort-7.9 {
# execsql { # execsql {

View File

@ -171,6 +171,8 @@ do_test trigger1-1.12 {
end; end;
} }
} {1 {cannot create INSTEAD OF trigger on table: main.t1}} } {1 {cannot create INSTEAD OF trigger on table: main.t1}}
ifcapable view {
# Ensure that we cannot create BEFORE triggers on views # Ensure that we cannot create BEFORE triggers on views
do_test trigger1-1.13 { do_test trigger1-1.13 {
catchsql { catchsql {
@ -190,6 +192,7 @@ do_test trigger1-1.14 {
end; end;
} }
} {1 {cannot create AFTER trigger on view: main.v1}} } {1 {cannot create AFTER trigger on view: main.v1}}
} ;# ifcapable view
# Check for memory leaks in the trigger parser # Check for memory leaks in the trigger parser
# #
@ -319,7 +322,7 @@ integrity_check trigger-5.1
# #
do_test trigger-6.1 { do_test trigger-6.1 {
execsql {SELECT type, name FROM sqlite_master} execsql {SELECT type, name FROM sqlite_master}
} {view v1 table t2} } [concat [ifcapable view {list view v1}] {table t2}]
do_test trigger-6.2 { do_test trigger-6.2 {
execsql { execsql {
CREATE TRIGGER t2 BEFORE DELETE ON t2 BEGIN CREATE TRIGGER t2 BEFORE DELETE ON t2 BEGIN
@ -327,7 +330,7 @@ do_test trigger-6.2 {
END; END;
SELECT type, name FROM sqlite_master; SELECT type, name FROM sqlite_master;
} }
} {view v1 table t2 trigger t2} } [concat [ifcapable view {list view v1}] {table t2 trigger t2}]
do_test trigger-6.3 { do_test trigger-6.3 {
catchsql {DELETE FROM t2} catchsql {DELETE FROM t2}
} {1 {deletes are not allows}} } {1 {deletes are not allows}}
@ -338,13 +341,13 @@ do_test trigger-6.5 {
db close db close
sqlite3 db test.db sqlite3 db test.db
execsql {SELECT type, name FROM sqlite_master} execsql {SELECT type, name FROM sqlite_master}
} {view v1 table t2 trigger t2} } [concat [ifcapable view {list view v1}] {table t2 trigger t2}]
do_test trigger-6.6 { do_test trigger-6.6 {
execsql { execsql {
DROP TRIGGER t2; DROP TRIGGER t2;
SELECT type, name FROM sqlite_master; SELECT type, name FROM sqlite_master;
} }
} {view v1 table t2} } [concat [ifcapable view {list view v1}] {table t2}]
do_test trigger-6.7 { do_test trigger-6.7 {
execsql {SELECT * FROM t2} execsql {SELECT * FROM t2}
} {3 4 7 8} } {3 4 7 8}

View File

@ -44,7 +44,7 @@
# trigger2-6.1[a-f]: INSERT statements # trigger2-6.1[a-f]: INSERT statements
# trigger2-6.2[a-f]: UPDATE statements # trigger2-6.2[a-f]: UPDATE statements
# #
# 7. Triggers on views fire correctly. # 7. & 8. Triggers on views fire correctly.
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -567,6 +567,8 @@ execsql {
} }
# 7. Triggers on views # 7. Triggers on views
ifcapable view {
do_test trigger2-7.1 { do_test trigger2-7.1 {
execsql { execsql {
CREATE TABLE ab(a, b); CREATE TABLE ab(a, b);
@ -710,6 +712,8 @@ do_test trigger2-8.6 {
} }
} {3 103 5 205 4 304 9 109 11 211 10 310} } {3 103 5 205 4 304 9 109 11 211 10 310}
} ;# ifcapable view
integrity_check trigger2-9.9 integrity_check trigger2-9.9
finish_test finish_test

View File

@ -137,6 +137,9 @@ do_test trigger3-6 {
} {1 2 3 1 2 3 1 2 3} } {1 2 3 1 2 3 1 2 3}
# Check that things also work for view-triggers # Check that things also work for view-triggers
ifcapable view {
execsql {CREATE VIEW tbl_view AS SELECT * FROM tbl} execsql {CREATE VIEW tbl_view AS SELECT * FROM tbl}
execsql { execsql {
CREATE TRIGGER tbl_view_insert INSTEAD OF INSERT ON tbl_view BEGIN CREATE TRIGGER tbl_view_insert INSTEAD OF INSERT ON tbl_view BEGIN
@ -162,6 +165,8 @@ do_test trigger3-7.3 {
} }
} {1 {View abort}} } {1 {View abort}}
} ;# ifcapable view
integrity_check trigger3-8.1 integrity_check trigger3-8.1
catchsql { DROP TABLE tbl; } catchsql { DROP TABLE tbl; }

View File

@ -12,7 +12,9 @@
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
ifcapable {!trigger} {
# If either views or triggers are disabled in this build, omit this file.
ifcapable {!trigger || !view} {
finish_test finish_test
return return
} }

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the VACUUM statement. # focus of this file is testing the VACUUM statement.
# #
# $Id: vacuum.test,v 1.30 2004/11/22 05:26:28 danielk1977 Exp $ # $Id: vacuum.test,v 1.31 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -85,7 +85,7 @@ ifcapable vacuum {
} {1} } {1}
} }
do_test vacuum-1.4 { do_test vacuum-1.4 {
execsql { set sql_script {
BEGIN; BEGIN;
CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t2 AS SELECT * FROM t1;
CREATE TABLE t3 AS SELECT * FROM t1; CREATE TABLE t3 AS SELECT * FROM t1;
@ -96,6 +96,12 @@ do_test vacuum-1.4 {
COMMIT; COMMIT;
DROP TABLE t2; DROP TABLE t2;
} }
# If the library was compiled to omit view support, comment out the
# create view in the script $sql_script before executing it.
ifcapable !view {
regsub {CREATE VIEW} $sql_script {-- CREATE VIEW} sql_script
}
execsql $sql_script
set ::size1 [file size test.db] set ::size1 [file size test.db]
set ::cksum [cksum] set ::cksum [cksum]
expr {$::cksum!=""} expr {$::cksum!=""}
@ -106,6 +112,7 @@ do_test vacuum-1.5 {
} }
cksum cksum
} $cksum } $cksum
ifcapable vacuum { ifcapable vacuum {
do_test vacuum-1.6 { do_test vacuum-1.6 {
expr {[file size test.db]<$::size1} expr {[file size test.db]<$::size1}
@ -171,8 +178,9 @@ do_test vacuum-4.2 {
} SQLITE_OK } SQLITE_OK
# Ticket #515. VACUUM after deleting and recreating the table that # Ticket #515. VACUUM after deleting and recreating the table that
# a view refers to. # a view refers to. Omit this test if the library is not view-enabled.
# #
ifcapable view {
do_test vacuum-5.1 { do_test vacuum-5.1 {
db close db close
file delete -force test.db file delete -force test.db
@ -197,6 +205,7 @@ do_test vacuum-5.2 {
VACUUM; VACUUM;
} }
} {0 {}} } {0 {}}
} ;# ifcapable view
# Ensure vacuum works with complicated tables names. # Ensure vacuum works with complicated tables names.
do_test vacuum-6.1 { do_test vacuum-6.1 {

View File

@ -11,10 +11,16 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing VIEW statements. # focus of this file is testing VIEW statements.
# #
# $Id: view.test,v 1.19 2004/11/03 16:27:02 drh Exp $ # $Id: view.test,v 1.20 2004/11/22 08:43:32 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# Omit this entire file if the library is not configured with views enabled.
ifcapable !view {
finish_test
return
}
do_test view-1.0 { do_test view-1.0 {
execsql { execsql {
CREATE TABLE t1(a,b,c); CREATE TABLE t1(a,b,c);