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

Add the SQLITE_OMIT_TEMPDB compile time macro. (CVS 2427)

FossilOrigin-Name: c41d55443c2dd532147962b87f542fb7d37075fd
This commit is contained in:
danielk1977
2005-03-29 03:10:59 +00:00
parent 50f059b871
commit 53c0f7480b
40 changed files with 1755 additions and 1490 deletions

View File

@ -1,5 +1,5 @@
C Fix\ssegfault\sdue\sto\sexception\shandler\sbeing\srun\swith\suninitialised\svariable.\s(CVS\s2426) C Add\sthe\sSQLITE_OMIT_TEMPDB\scompile\stime\smacro.\s(CVS\s2427)
D 2005-03-29T02:54:03 D 2005-03-29T03:10:59
F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3 F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -32,7 +32,7 @@ F src/attach.c 3615dbe960cbee4aa5ea300b8a213dad36527b0f
F src/auth.c 18c5a0befe20f3a58a41e3ddd78f372faeeefe1f F src/auth.c 18c5a0befe20f3a58a41e3ddd78f372faeeefe1f
F src/btree.c 50f31eb0844ca14614686163f8939b2999272b25 F src/btree.c 50f31eb0844ca14614686163f8939b2999272b25
F src/btree.h 41a71ce027db9ddee72cb43df2316bbe3a1d92af F src/btree.h 41a71ce027db9ddee72cb43df2316bbe3a1d92af
F src/build.c 2589c2ffa263406526d0cc5728405c6c2f9638f6 F src/build.c 8afb06c791adcde7787f157bbc55aeef27fb27c1
F src/date.c 2134ef4388256e8247405178df8a61bd60dc180a F src/date.c 2134ef4388256e8247405178df8a61bd60dc180a
F src/delete.c d70d54a84695de92efc05b9db7d3684cd21d9094 F src/delete.c d70d54a84695de92efc05b9db7d3684cd21d9094
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
@ -42,7 +42,7 @@ F src/hash.c 2b1b13f7400e179631c83a1be0c664608c8f021f
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 34c25c33f51a43644a42cc091ac967b070c6b6d5 F src/insert.c 34c25c33f51a43644a42cc091ac967b070c6b6d5
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c 2062faded47289c50cdbc083e00d1aa9a872f1a1 F src/main.c 531fab947f72d3b6e86476ed4594838a2fa277f5
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h 0c805df3df02b98eb78a7a86756c3cbd4e190939 F src/os.h 0c805df3df02b98eb78a7a86756c3cbd4e190939
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73 F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
@ -54,28 +54,28 @@ F src/os_win.c 2bbbe6fbb010763c3fa79d5e951afca9b138c6b5
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 95e24c9134a00613ca87b963a84ad62d85d5b979 F src/pager.c 95e24c9134a00613ca87b963a84ad62d85d5b979
F src/pager.h 9a417a1e04737c227ebbba3bdf8597d6dd51513a F src/pager.h 9a417a1e04737c227ebbba3bdf8597d6dd51513a
F src/parse.y 10c0ace9efce31d5a06e03488a4284b9d97abc56 F src/parse.y 1770b8673c652756b2dd5bcec16f0bf741e5e879
F src/pragma.c 4b20dbc0f4b97f412dc511853d3d0c2e0d4adedc F src/pragma.c 845c8ab0ab7d09ed2115d3dfc859ba2364b365a7
F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357 F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c a324af36afe5f050a1e070806ad3ededf1d58f50 F src/select.c a324af36afe5f050a1e070806ad3ededf1d58f50
F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26 F src/shell.c 25b3217d7c64e6497225439d261a253a23efff26
F src/sqlite.h.in 33e7201f78b3f4aa306d885b69e68fa0f0286368 F src/sqlite.h.in 33e7201f78b3f4aa306d885b69e68fa0f0286368
F src/sqliteInt.h ecb1592406cf4c684f0ad9ce1bc4fe2a37a61efb F src/sqliteInt.h 474c20597ee66bb3a666bed0abd76e7be579184a
F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9
F src/tclsqlite.c 29e56ecdb94c4066dbe6b088d12cc2404bc9597e F src/tclsqlite.c 29e56ecdb94c4066dbe6b088d12cc2404bc9597e
F src/test1.c 13d1d2198b3267c8dc6abd22ada4a992c79acefc F src/test1.c 32a158ca4aca2e9b43d911eda4552253df9a207d
F src/test2.c 7f0ef466706ac01414e1136b96e5d8a65cb97545 F src/test2.c 7f0ef466706ac01414e1136b96e5d8a65cb97545
F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5 F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
F src/tokenize.c 103cbaa932c790f540f8eceb63cd3010e117bdff F src/tokenize.c 103cbaa932c790f540f8eceb63cd3010e117bdff
F src/trigger.c 0c3ec8a6cb7176aaecc3978bfc34050ec1a852c4 F src/trigger.c 1a6d0c7c51b70bdc58d5068be72034071eff23ad
F src/update.c 42823d00865c9fe4f01b3c62647858726345a28e F src/update.c 42823d00865c9fe4f01b3c62647858726345a28e
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
F src/util.c 02bc2750336b021b3f10e61538f665c4b0033b5d F src/util.c 02bc2750336b021b3f10e61538f665c4b0033b5d
F src/vacuum.c 5cf598003191bd91c17a64742bad8e46241698a8 F src/vacuum.c 5cf598003191bd91c17a64742bad8e46241698a8
F src/vdbe.c c7973dc0ab52538646018620e3d3c68aa9e6d6c4 F src/vdbe.c e93a28aaa2a59c398ae243c2dc3b2da10cf1c5d2
F src/vdbe.h 7f586cb6d6b57764e5aac1f87107d6a95ddce24c F src/vdbe.h 7f586cb6d6b57764e5aac1f87107d6a95ddce24c
F src/vdbeInt.h e80721cd8ff611789e20743eec43363a9fb5a48e F src/vdbeInt.h e80721cd8ff611789e20743eec43363a9fb5a48e
F src/vdbeapi.c 467caa6e6fb9247528b1c7ab9132ae1b4748e8ac F src/vdbeapi.c 467caa6e6fb9247528b1c7ab9132ae1b4748e8ac
@ -84,14 +84,14 @@ F src/vdbemem.c 4e853ce3151eaf7906150da85a1b3ce1fe5e8da8
F src/where.c c4b227458e8993decb515ed9a2fe2d4f5f8e3125 F src/where.c c4b227458e8993decb515ed9a2fe2d4f5f8e3125
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3 F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3
F test/alter.test 3a20ce14c3989f7e2e75da50797065c2e56f838b F test/alter.test 9d6837a3d946b73df692b7cef2a7644d2e2f6bc6
F test/alter2.test 60ba0a7057dc71ad630a1cc7c487104346849d50 F test/alter2.test 60ba0a7057dc71ad630a1cc7c487104346849d50
F test/alter3.test 1e88e71dde15a1c592ca2aba692bf70ff54886f6 F test/alter3.test d4eecd8dbd008d0e66f1c201fa6dc2edca853c38
F test/attach.test e6bda19cc954fd84836fadbd70d80134cb17918a F test/attach.test f320e98bcca68d100cab7666a0c9a93ac5f236bd
F test/attach2.test 6f3a3a3a7f5be40388dd4d805e0e0712718dca9d F test/attach2.test 3396c012a39ddf7ba6b528d80bd79554168aa115
F test/attach3.test c05c70b933afbde0901dab9da3e66ee842c09f38 F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe
F test/auth.test b24d12de3a6ba49237216429f8dc672a8a52b342 F test/auth.test 5129bfe268133092ad2928b8644ef97fa4602b2e
F test/autoinc.test d619da7d5cb9a3d63e6a7925259fc173f7e2080e F test/autoinc.test bef47b3c1c1093599905d1d9c79140f265896db0
F test/autovacuum.test cf2719b17659f7a011202ad05905654cedf26023 F test/autovacuum.test cf2719b17659f7a011202ad05905654cedf26023
F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31
F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24 F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24
@ -106,7 +106,7 @@ F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2 F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027 F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027
F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f
F test/capi2.test 2bd71f573b32e3ac5b97441a55873eae14eeab0d F test/capi2.test f897209386fb21cfdc9267595e0c667ebaca9164
F test/capi3.test 7c1c91895239fef05427ceb628a193cb4f61031f F test/capi3.test 7c1c91895239fef05427ceb628a193cb4f61031f
F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336 F test/capi3b.test 5b6a66f9f295f79f443b5d3f33187fa5ef6cf336
F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03 F test/collate1.test f79736d2ebf5492167ee4d1f4ab4c09dda776b03
@ -129,51 +129,51 @@ F test/enc2.test d1ab077b84f4d3099246915422b1ab6b81481e0a
F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837 F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837
F test/expr.test 54d9d1cc05eb731fa62daa70f2d7163f8a03c54d F test/expr.test 54d9d1cc05eb731fa62daa70f2d7163f8a03c54d
F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
F test/func.test 9a467351e2a50c8846623ac7451d3bc2516b6e6d F test/func.test 7d2d8489bede4495feca427c5efc7b7a2f3b1e94
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
F test/in.test ed134f8d477a6280297ced1646de83cccf8f196d F test/in.test ed134f8d477a6280297ced1646de83cccf8f196d
F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
F test/index3.test 72bd07b508022db688ec536c460345d24a3912e3 F test/index3.test 72bd07b508022db688ec536c460345d24a3912e3
F test/insert.test 9a9c5774e4cf985d08edfe870d9db20c3849b5d2 F test/insert.test 1781f8ec647ef96cadee3d0c63557fd0c16feceb
F test/insert2.test 065f179a21b42f9746b97571b8ad10b092e90913 F test/insert2.test 8d71cb249cfed3803fa77def6336ff0592caffa0
F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95 F test/insert3.test c67f0240b1c17e71fa2ed8bb6de064928f549f95
F test/interrupt.test 5b4d8389e6cf2d01b94f87cfd02d9df1073bfb2d F test/interrupt.test 170f87c2819f0e56c76e0a754949ea103d05009c
F test/intpkey.test ce2a5d91120a831fc076fbf98fce132e192bad69 F test/intpkey.test ce2a5d91120a831fc076fbf98fce132e192bad69
F test/ioerr.test b27540c5873d28c0e77f02ce85b15f904d5b03a6 F test/ioerr.test b27540c5873d28c0e77f02ce85b15f904d5b03a6
F test/join.test e08471279574487cac0d17fa1ea66aca15c4de7f F test/join.test e08471279574487cac0d17fa1ea66aca15c4de7f
F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test cc6cafe85e11aacacd0abcd247a46bed251308f8 F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19 F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/lastinsert.test b6a1db3e1ce2d3f0d6afe99d445084f543b6feaa F test/lastinsert.test eaa89c6ee1f13062d87139fd32c1e56753d2fd89
F test/laststmtchanges.test 07cbdabc52407c29e40abc25050f2434f044a6b1 F test/laststmtchanges.test 19a6d0c11f7a31dc45465b495f7b845a62cbec17
F test/limit.test 270b076f31c5c32f7187de5727e74da4de43e477 F test/limit.test 270b076f31c5c32f7187de5727e74da4de43e477
F test/lock.test 0b95ae28471f5123d24008d1c0fead911bf3c4be F test/lock.test 9b7afcb24f53d24da502abb33daaad2cd6d44107
F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/main.test febb69416071134dc38b9b1971c0c2e5b0ca3ff8 F test/main.test febb69416071134dc38b9b1971c0c2e5b0ca3ff8
F test/malloc.test b7bc72bb1627e09d6003f58de9bcd6e4be839753 F test/malloc.test b7bc72bb1627e09d6003f58de9bcd6e4be839753
F test/malloc2.test 5375a1cd53caffd56fd06410c5bddc10f6dccded F test/malloc2.test 93b07cd12f9776161bc724dbf7b749817e982a49
F test/memdb.test 1860e060be810bf0775bc57408a5b7c4954bcaea F test/memdb.test 1860e060be810bf0775bc57408a5b7c4954bcaea
F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac
F test/minmax.test 9429a06f1f93acf76fcacafd17160a4392e88526 F test/minmax.test 9429a06f1f93acf76fcacafd17160a4392e88526
F test/misc1.test ff817d3740458884fea535b44821ec7e84700457 F test/misc1.test a4a36c19f05e4c8646efe7a0d7242ba645d07379
F test/misc2.test fc052267d5178367f955538ae34aae1b2f696a92 F test/misc2.test d51379cc670b850827cd37b7fc07c0f17736004e
F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03 F test/misc3.test 7bd937e2c62bcc6be71939faf068d506467b1e03
F test/misc4.test 98e5fb5544aeac6cbbc529c79d4144b0936c22de F test/misc4.test edd3e3adf5b6e3b995b29843565ca58dd602f9a7
F test/misc5.test 406d3f9523953a028307d076f2eb2687218cb46d F test/misc5.test 406d3f9523953a028307d076f2eb2687218cb46d
F test/misuse.test 1c7fee3c4c0cb4008717ecccf5c72281fac0008e F test/misuse.test 1c7fee3c4c0cb4008717ecccf5c72281fac0008e
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 69c62daf1630bf54c87bbc7ef2e22012e58d6da8 F test/null.test 69c62daf1630bf54c87bbc7ef2e22012e58d6da8
F test/pager.test 1579e8f07291ae8e24db62ffade5c101c3e76597 F test/pager.test 1579e8f07291ae8e24db62ffade5c101c3e76597
F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e F test/pager2.test 49c0f57c7da0b060f0486b85fdd074025caa694e
F test/pager3.test 647f696a9cf7409df00a1e0047c2eb55585a1b85 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pagesize.test 1b826d1608fd86d2303aa895b5586052ad07eba1 F test/pagesize.test 1b826d1608fd86d2303aa895b5586052ad07eba1
F test/pragma.test 52e4ba758004e2200ff153d09c8b92f19bf940bc F test/pragma.test effcf2f0dea35223cbaa6bf40c47d0796ba39e40
F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57 F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
F test/progress.test 16496001da445e6534afb94562c286708316d82f x F test/progress.test 16496001da445e6534afb94562c286708316d82f x
F test/quick.test 869345bbe45fdad6e3fcc0fc9ec116c0499530c3 F test/quick.test e9fdedf06bd06ff22fcbf6895c4f62fcbeb9e6b4
F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62 F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62
F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b F test/reindex.test 38b138abe36bf9a08c791ed44d9f76cd6b97b78b
F test/rollback.test 94cd981ee3a627d9f6466f69dcf1f7dbfe695d7a F test/rollback.test 94cd981ee3a627d9f6466f69dcf1f7dbfe695d7a
@ -186,22 +186,22 @@ F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca F test/select4.test c239f516aa31f42f2ef7c6d7cd01105f08f934ca
F test/select5.test 2d414f712bff8e590091e08f9b7287600731be00 F test/select5.test 2d414f712bff8e590091e08f9b7287600731be00
F test/select6.test 6e5a1a70a788cdbe515d1252dd0917d7e9d1d71e F test/select6.test 6e5a1a70a788cdbe515d1252dd0917d7e9d1d71e
F test/select7.test 8f3362336c10d828ab6fe9c1b8897b484da8b592 F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/sort.test 312eade533cb3c7667110ccfa6e818db1078fd6c F test/sort.test 312eade533cb3c7667110ccfa6e818db1078fd6c
F test/subquery.test 6274cce7617bc7f625490759cbe4f0c0eef24895 F test/subquery.test 6274cce7617bc7f625490759cbe4f0c0eef24895
F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614 F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614
F test/table.test a2a58cae70ef2511cbf27d40fb8f570106a2677e F test/table.test e87fb2211b97c6a3a367fbc116e8572091b53160
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1 F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 4ac312b47632596516353948b59089b02312aed7 F test/tclsqlite.test 4ac312b47632596516353948b59089b02312aed7
F test/temptable.test 63a16e3ad19adf073cfbcdf7624c92ac5236522c F test/temptable.test c71eeffe8af807f76eafdc5a39824639a1e301df
F test/tester.tcl 69c0dc1accaf0ff26bff62b33e13590a4ecba17d F test/tester.tcl 69c0dc1accaf0ff26bff62b33e13590a4ecba17d
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b 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 ab6924a953fd2b262f77ea1aa5f11c05f6a10447 F test/trans.test 10506dc30305cfb8c4098359f7f6f64786f69c5e
F test/trigger1.test 9db1a7c91930baa2dc60ce72c7e969900bf2ae8a F test/trigger1.test 4c68031fbf62966311163586bdb504b168643b49
F test/trigger2.test cbc8fe3775904d5b49ff26888aa39df7341fae7c F test/trigger2.test f671b922c88f70c3cd2c6f03fe7c256ae7a52fc4
F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2 F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2
F test/trigger4.test e7c0812b14750754602468f15495260e8c6625e0 F test/trigger4.test e7c0812b14750754602468f15495260e8c6625e0
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
@ -211,7 +211,7 @@ F test/types2.test 81dd1897be8ef4b5b73d0006e6076abe40610de3
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf F test/update.test 7669ca789d62c258b678e8aa7a22a57eac10f2cf
F test/utf16.test 5fb019e09601774743858ef7380b6c02103ff120 F test/utf16.test 5fb019e09601774743858ef7380b6c02103ff120
F test/vacuum.test 76c4bc4589353d071e81c003a25338d02560474d F test/vacuum.test 5d4857ae2afc9c20d0edb8acc58bdc8d630126a9
F test/vacuum2.test 5d77e98c458bcdbeecc6327de5107179ba1aa095 F test/vacuum2.test 5d77e98c458bcdbeecc6327de5107179ba1aa095
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 306cc4342eb03c28de1a92c681836189e03e5af9 F test/view.test 306cc4342eb03c28de1a92c681836189e03e5af9
@ -278,7 +278,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
P 4ca11ca015d798655170593c1b76d312185d6ed2 P 78df3d040443414ae5b440eeabc0c8c205ab311d
R e4c51e3e56b7ef33b113201f3420a8cc R ab70e88fa1e907bd768a36809abb74cd
U danielk1977 U danielk1977
Z 36ddc864efbca1aee674c9701d1319c4 Z a20882d0dd8ba8be64666597fc85c766

View File

@ -1 +1 @@
78df3d040443414ae5b440eeabc0c8c205ab311d c41d55443c2dd532147962b87f542fb7d37075fd

View File

@ -22,7 +22,7 @@
** COMMIT ** COMMIT
** ROLLBACK ** ROLLBACK
** **
** $Id: build.c,v 1.317 2005/03/28 03:39:56 drh Exp $ ** $Id: build.c,v 1.318 2005/03/29 03:10:59 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@ -168,7 +168,7 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
int i; int i;
assert( zName!=0 ); assert( zName!=0 );
assert( (db->flags & SQLITE_Initialized) || db->init.busy ); assert( (db->flags & SQLITE_Initialized) || db->init.busy );
for(i=0; i<db->nDb; i++){ for(i=OMIT_TEMPDB; i<db->nDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue; if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue;
p = sqlite3HashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1); p = sqlite3HashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1);
@ -227,7 +227,7 @@ Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
Index *p = 0; Index *p = 0;
int i; int i;
assert( (db->flags & SQLITE_Initialized) || db->init.busy ); assert( (db->flags & SQLITE_Initialized) || db->init.busy );
for(i=0; i<db->nDb; i++){ for(i=OMIT_TEMPDB; i<db->nDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue; if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue;
p = sqlite3HashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1); p = sqlite3HashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1);
@ -537,7 +537,8 @@ static int findDb(sqlite3 *db, Token *pName){
if( zName ){ if( zName ){
n = strlen(zName); n = strlen(zName);
for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
if( n==strlen(pDb->zName) && 0==sqlite3StrICmp(pDb->zName, zName) ){ if( (!OMIT_TEMPDB || i!=1 ) && n==strlen(pDb->zName) &&
0==sqlite3StrICmp(pDb->zName, zName) ){
break; break;
} }
} }
@ -656,12 +657,12 @@ void sqlite3StartTable(
*/ */
iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
if( iDb<0 ) return; if( iDb<0 ) return;
if( isTemp && iDb>1 ){ if( !OMIT_TEMPDB && isTemp && iDb>1 ){
/* If creating a temp table, the name may not be qualified */ /* If creating a temp table, the name may not be qualified */
sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); sqlite3ErrorMsg(pParse, "temporary table name must be unqualified");
return; return;
} }
if( isTemp ) iDb = 1; if( !OMIT_TEMPDB && isTemp ) iDb = 1;
pParse->sNameToken = *pName; pParse->sNameToken = *pName;
zName = sqlite3NameFromToken(pName); zName = sqlite3NameFromToken(pName);
@ -679,13 +680,13 @@ void sqlite3StartTable(
goto begin_table_error; goto begin_table_error;
} }
if( isView ){ if( isView ){
if( isTemp ){ if( !OMIT_TEMPDB && isTemp ){
code = SQLITE_CREATE_TEMP_VIEW; code = SQLITE_CREATE_TEMP_VIEW;
}else{ }else{
code = SQLITE_CREATE_VIEW; code = SQLITE_CREATE_VIEW;
} }
}else{ }else{
if( isTemp ){ if( !OMIT_TEMPDB && isTemp ){
code = SQLITE_CREATE_TEMP_TABLE; code = SQLITE_CREATE_TEMP_TABLE;
}else{ }else{
code = SQLITE_CREATE_TABLE; code = SQLITE_CREATE_TABLE;
@ -1376,7 +1377,7 @@ static char *createTableStmt(Table *p){
n += 35 + 6*p->nCol; n += 35 + 6*p->nCol;
zStmt = sqliteMallocRaw( n ); zStmt = sqliteMallocRaw( n );
if( zStmt==0 ) return 0; if( zStmt==0 ) return 0;
strcpy(zStmt, p->iDb==1 ? "CREATE TEMP TABLE " : "CREATE TABLE "); strcpy(zStmt, !OMIT_TEMPDB&&p->iDb==1 ? "CREATE TEMP TABLE ":"CREATE TABLE ");
k = strlen(zStmt); k = strlen(zStmt);
identPut(zStmt, &k, p->zName); identPut(zStmt, &k, p->zName);
zStmt[k++] = '('; zStmt[k++] = '(';
@ -1865,13 +1866,13 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView){
goto exit_drop_table; goto exit_drop_table;
} }
if( isView ){ if( isView ){
if( iDb==1 ){ if( !OMIT_TEMPDB && iDb==1 ){
code = SQLITE_DROP_TEMP_VIEW; code = SQLITE_DROP_TEMP_VIEW;
}else{ }else{
code = SQLITE_DROP_VIEW; code = SQLITE_DROP_VIEW;
} }
}else{ }else{
if( iDb==1 ){ if( !OMIT_TEMPDB && iDb==1 ){
code = SQLITE_DROP_TEMP_TABLE; code = SQLITE_DROP_TEMP_TABLE;
}else{ }else{
code = SQLITE_DROP_TABLE; code = SQLITE_DROP_TABLE;
@ -2189,7 +2190,6 @@ void sqlite3CreateIndex(
int i, j; int i, j;
Token nullId; /* Fake token for an empty ID list */ Token nullId; /* Fake token for an empty ID list */
DbFixer sFix; /* For assigning database names to pTable */ DbFixer sFix; /* For assigning database names to pTable */
int isTemp; /* True for a temporary index */
sqlite3 *db = pParse->db; sqlite3 *db = pParse->db;
int iDb; /* Index of the database that is being written */ int iDb; /* Index of the database that is being written */
@ -2210,6 +2210,7 @@ void sqlite3CreateIndex(
iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
if( iDb<0 ) goto exit_create_index; if( iDb<0 ) goto exit_create_index;
#ifndef SQLITE_OMIT_TEMPDB
/* If the index name was unqualified, check if the the table /* If the index name was unqualified, check if the the table
** is a temp table. If so, set the database to 1. ** is a temp table. If so, set the database to 1.
*/ */
@ -2217,6 +2218,7 @@ void sqlite3CreateIndex(
if( pName2 && pName2->n==0 && pTab && pTab->iDb==1 ){ if( pName2 && pName2->n==0 && pTab && pTab->iDb==1 ){
iDb = 1; iDb = 1;
} }
#endif
if( sqlite3FixInit(&sFix, pParse, iDb, "index", pName) && if( sqlite3FixInit(&sFix, pParse, iDb, "index", pName) &&
sqlite3FixSrcList(&sFix, pTblName) sqlite3FixSrcList(&sFix, pTblName)
@ -2244,7 +2246,6 @@ void sqlite3CreateIndex(
goto exit_create_index; goto exit_create_index;
} }
#endif #endif
isTemp = pTab->iDb==1;
/* /*
** Find the name of the index. Make sure there is not already another ** Find the name of the index. Make sure there is not already another
@ -2294,12 +2295,12 @@ void sqlite3CreateIndex(
*/ */
#ifndef SQLITE_OMIT_AUTHORIZATION #ifndef SQLITE_OMIT_AUTHORIZATION
{ {
const char *zDb = db->aDb[pTab->iDb].zName; const char *zDb = db->aDb[iDb].zName;
if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){ if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){
goto exit_create_index; goto exit_create_index;
} }
i = SQLITE_CREATE_INDEX; i = SQLITE_CREATE_INDEX;
if( isTemp ) i = SQLITE_CREATE_TEMP_INDEX; if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX;
if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){ if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){
goto exit_create_index; goto exit_create_index;
} }
@ -2562,7 +2563,7 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName){
if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
goto exit_drop_index; goto exit_drop_index;
} }
if( pIndex->iDb ) code = SQLITE_DROP_TEMP_INDEX; if( !OMIT_TEMPDB && pIndex->iDb ) code = SQLITE_DROP_TEMP_INDEX;
if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){ if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
goto exit_drop_index; goto exit_drop_index;
} }
@ -2870,7 +2871,7 @@ void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
if( (pParse->cookieMask & mask)==0 ){ if( (pParse->cookieMask & mask)==0 ){
pParse->cookieMask |= mask; pParse->cookieMask |= mask;
pParse->cookieValue[iDb] = db->aDb[iDb].schema_cookie; pParse->cookieValue[iDb] = db->aDb[iDb].schema_cookie;
if( iDb==1 ){ if( !OMIT_TEMPDB && iDb==1 ){
sqlite3OpenTempDatabase(pParse); sqlite3OpenTempDatabase(pParse);
} }
} }
@ -2903,7 +2904,7 @@ void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){
if( setStatement && pParse->nested==0 ){ if( setStatement && pParse->nested==0 ){
sqlite3VdbeAddOp(v, OP_Statement, iDb, 0); sqlite3VdbeAddOp(v, OP_Statement, iDb, 0);
} }
if( iDb!=1 && pParse->db->aDb[1].pBt!=0 ){ if( (OMIT_TEMPDB || iDb!=1) && pParse->db->aDb[1].pBt!=0 ){
sqlite3BeginWriteOperation(pParse, setStatement, 1); sqlite3BeginWriteOperation(pParse, setStatement, 1);
} }
} }

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.283 2005/03/21 04:04:03 danielk1977 Exp $ ** $Id: main.c,v 1.284 2005/03/29 03:10:59 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -133,7 +133,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
int meta[10]; int meta[10];
InitData initData; InitData initData;
char const *zMasterSchema; char const *zMasterSchema;
char const *zMasterName; char const *zMasterName = SCHEMA_TABLE(iDb);
/* /*
** The master database table has a structure like this ** The master database table has a structure like this
@ -147,6 +147,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
" sql text\n" " sql text\n"
")" ")"
; ;
#ifndef SQLITE_OMIT_TEMPDB
static const char temp_master_schema[] = static const char temp_master_schema[] =
"CREATE TEMP TABLE sqlite_temp_master(\n" "CREATE TEMP TABLE sqlite_temp_master(\n"
" type text,\n" " type text,\n"
@ -156,6 +157,9 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
" sql text\n" " sql text\n"
")" ")"
; ;
#else
#define temp_master_schema 0
#endif
assert( iDb>=0 && iDb<db->nDb ); assert( iDb>=0 && iDb<db->nDb );
@ -163,13 +167,12 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
** and initialisation script appropriate for the database being ** and initialisation script appropriate for the database being
** initialised. zMasterName is the name of the master table. ** initialised. zMasterName is the name of the master table.
*/ */
if( iDb==1 ){ if( !OMIT_TEMPDB && iDb==1 ){
zMasterSchema = temp_master_schema; zMasterSchema = temp_master_schema;
zMasterName = TEMP_MASTER_NAME;
}else{ }else{
zMasterSchema = master_schema; zMasterSchema = master_schema;
zMasterName = MASTER_NAME;
} }
zMasterName = SCHEMA_TABLE(iDb);
/* Construct the schema tables. */ /* Construct the schema tables. */
sqlite3SafetyOff(db); sqlite3SafetyOff(db);
@ -195,7 +198,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
/* Create a cursor to hold the database open /* Create a cursor to hold the database open
*/ */
if( db->aDb[iDb].pBt==0 ){ if( db->aDb[iDb].pBt==0 ){
if( iDb==1 ) DbSetProperty(db, 1, DB_SchemaLoaded); if( !OMIT_TEMPDB && iDb==1 ) DbSetProperty(db, 1, DB_SchemaLoaded);
return SQLITE_OK; return SQLITE_OK;
} }
rc = sqlite3BtreeCursor(db->aDb[iDb].pBt, MASTER_ROOT, 0, 0, 0, &curMain); rc = sqlite3BtreeCursor(db->aDb[iDb].pBt, MASTER_ROOT, 0, 0, 0, &curMain);
@ -351,12 +354,14 @@ int sqlite3Init(sqlite3 *db, char **pzErrMsg){
** for the TEMP database. This is loaded last, as the TEMP database ** for the TEMP database. This is loaded last, as the TEMP database
** schema may contain references to objects in other databases. ** schema may contain references to objects in other databases.
*/ */
#ifndef SQLITE_OMIT_TEMPDB
if( rc==SQLITE_OK && db->nDb>1 && !DbHasProperty(db, 1, DB_SchemaLoaded) ){ if( rc==SQLITE_OK && db->nDb>1 && !DbHasProperty(db, 1, DB_SchemaLoaded) ){
rc = sqlite3InitOne(db, 1, pzErrMsg); rc = sqlite3InitOne(db, 1, pzErrMsg);
if( rc ){ if( rc ){
sqlite3ResetInternalSchema(db, 1); sqlite3ResetInternalSchema(db, 1);
} }
} }
#endif
db->init.busy = 0; db->init.busy = 0;
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
@ -1205,13 +1210,17 @@ static int openDatabase(
db->magic = SQLITE_MAGIC_CLOSED; db->magic = SQLITE_MAGIC_CLOSED;
goto opendb_out; goto opendb_out;
} }
db->aDb[0].zName = "main";
db->aDb[1].zName = "temp";
/* The default safety_level for the main database is 'full' for the temp /* The default safety_level for the main database is 'full'; for the temp
** database it is 'NONE'. This matches the pager layer defaults. */ ** database it is 'NONE'. This matches the pager layer defaults.
*/
db->aDb[0].zName = "main";
db->aDb[0].safety_level = 3; db->aDb[0].safety_level = 3;
#ifndef SQLITE_OMIT_TEMPDB
db->aDb[1].zName = "temp";
db->aDb[1].safety_level = 1; db->aDb[1].safety_level = 1;
#endif
/* Register all built-in functions, but do not attempt to read the /* Register all built-in functions, but do not attempt to read the
** database schema yet. This is delayed until the first time the database ** database schema yet. This is delayed until the first time the database

View File

@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing ** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens. ** numeric codes for all of the tokens.
** **
** @(#) $Id: parse.y,v 1.169 2005/03/17 05:03:40 danielk1977 Exp $ ** @(#) $Id: parse.y,v 1.170 2005/03/29 03:10:59 danielk1977 Exp $
*/ */
%token_prefix TK_ %token_prefix TK_
%token_type {Token} %token_type {Token}
@ -112,7 +112,9 @@ create_table ::= CREATE(X) temp(T) TABLE nm(Y) dbnm(Z). {
sqlite3StartTable(pParse,&X,&Y,&Z,T,0); sqlite3StartTable(pParse,&X,&Y,&Z,T,0);
} }
%type temp {int} %type temp {int}
%ifndef SQLITE_OMIT_TEMPDB
temp(A) ::= TEMP. {A = 1;} temp(A) ::= TEMP. {A = 1;}
%endif
temp(A) ::= . {A = 0;} temp(A) ::= . {A = 0;}
create_table_args ::= LP columnlist conslist_opt(X) RP(Y). { create_table_args ::= LP columnlist conslist_opt(X) RP(Y). {
sqlite3EndTable(pParse,&X,&Y,0); sqlite3EndTable(pParse,&X,&Y,0);

View File

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to implement the PRAGMA command. ** This file contains code used to implement the PRAGMA command.
** **
** $Id: pragma.c,v 1.90 2005/02/26 18:10:44 drh Exp $ ** $Id: pragma.c,v 1.91 2005/03/29 03:10:59 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -645,6 +645,8 @@ void sqlite3Pragma(
HashElem *x; HashElem *x;
int cnt = 0; int cnt = 0;
if( OMIT_TEMPDB && i==1 ) continue;
sqlite3CodeVerifySchema(pParse, i); sqlite3CodeVerifySchema(pParse, i);
/* Do an integrity check of the B-Tree /* Do an integrity check of the B-Tree

View File

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.374 2005/03/21 04:04:03 danielk1977 Exp $ ** @(#) $Id: sqliteInt.h,v 1.375 2005/03/29 03:10:59 danielk1977 Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@ -67,6 +67,17 @@
# define TEMP_PAGES 500 # define TEMP_PAGES 500
#endif #endif
/*
** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
** afterward. Having this macro allows us to cause the C compiler
** to omit code used by TEMP tables without messy #ifndef statements.
*/
#ifdef SQLITE_OMIT_TEMPDB
#define OMIT_TEMPDB 1
#else
#define OMIT_TEMPDB 0
#endif
/* /*
** If the following macro is set to 1, then NULL values are considered ** If the following macro is set to 1, then NULL values are considered
** distinct for the SELECT DISTINCT statement and for UNION or EXCEPT ** distinct for the SELECT DISTINCT statement and for UNION or EXCEPT
@ -292,7 +303,7 @@ extern int sqlite3_iMallocReset; /* Set iMallocFail to this when it reaches 0 */
/* /*
** The name of the schema table. ** The name of the schema table.
*/ */
#define SCHEMA_TABLE(x) (x==1?TEMP_MASTER_NAME:MASTER_NAME) #define SCHEMA_TABLE(x) ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)
/* /*
** A convenience macro that returns the number of elements in ** A convenience macro that returns the number of elements in

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated ** is not included in the SQLite library. It is used for automated
** testing of the SQLite library. ** testing of the SQLite library.
** **
** $Id: test1.c,v 1.135 2005/03/21 04:04:02 danielk1977 Exp $ ** $Id: test1.c,v 1.136 2005/03/29 03:11:00 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@ -2862,6 +2862,12 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
#endif #endif
#ifdef SQLITE_OMIT_TEMPDB
Tcl_SetVar2(interp, "sqlite_options", "tempdb", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "tempdb", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_UTF16 #ifdef SQLITE_OMIT_UTF16
Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
#else #else

View File

@ -197,9 +197,9 @@ void sqlite3FinishTrigger(
sqlite3 *db = pParse->db; /* The database */ sqlite3 *db = pParse->db; /* The database */
DbFixer sFix; DbFixer sFix;
if( pParse->nErr || pParse->pNewTrigger==0 ) goto triggerfinish_cleanup;
pTrig = pParse->pNewTrigger; pTrig = pParse->pNewTrigger;
pParse->pNewTrigger = 0; pParse->pNewTrigger = 0;
if( pParse->nErr || pTrig==0 ) goto triggerfinish_cleanup;
pTrig->step_list = pStepList; pTrig->step_list = pStepList;
while( pStepList ){ while( pStepList ){
pStepList->pTrig = pTrig; pStepList->pTrig = pTrig;
@ -439,7 +439,7 @@ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){
zDb = pName->a[0].zDatabase; zDb = pName->a[0].zDatabase;
zName = pName->a[0].zName; zName = pName->a[0].zName;
nName = strlen(zName); nName = strlen(zName);
for(i=0; i<db->nDb; i++){ for(i=OMIT_TEMPDB; i<db->nDb; i++){
int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue; if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue;
pTrigger = sqlite3HashFind(&(db->aDb[j].trigHash), zName, nName+1); pTrigger = sqlite3HashFind(&(db->aDb[j].trigHash), zName, nName+1);

View File

@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.460 2005/03/21 03:53:38 danielk1977 Exp $ ** $Id: vdbe.c,v 1.461 2005/03/29 03:11:00 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -3819,7 +3819,7 @@ case OP_ParseSchema: {
assert( iDb>=0 && iDb<db->nDb ); assert( iDb>=0 && iDb<db->nDb );
if( !DbHasProperty(db, iDb, DB_SchemaLoaded) ) break; if( !DbHasProperty(db, iDb, DB_SchemaLoaded) ) break;
zMaster = iDb==1 ? TEMP_MASTER_NAME : MASTER_NAME; zMaster = SCHEMA_TABLE(iDb);
initData.db = db; initData.db = db;
initData.pzErrMsg = &p->zErrMsg; initData.pzErrMsg = &p->zErrMsg;
zSql = sqlite3MPrintf( zSql = sqlite3MPrintf(

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 testing the ALTER TABLE statement. # focus of this script is testing the ALTER TABLE statement.
# #
# $Id: alter.test,v 1.10 2005/02/14 06:38:40 danielk1977 Exp $ # $Id: alter.test,v 1.11 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -43,7 +43,12 @@ ifcapable !altertable {
# and some tables with odd names. # and some tables with odd names.
# #
do_test alter-1.1 { do_test alter-1.1 {
execsql { ifcapable tempdb {
set ::temp TEMP
} else {
set ::temp {}
}
execsql [subst -nocommands {
CREATE TABLE t1(a,b); CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(1,2);
CREATE TABLE [t1'x1](c UNIQUE, b PRIMARY KEY); CREATE TABLE [t1'x1](c UNIQUE, b PRIMARY KEY);
@ -51,10 +56,10 @@ do_test alter-1.1 {
CREATE INDEX t1i1 ON T1(B); CREATE INDEX t1i1 ON T1(B);
CREATE INDEX t1i2 ON t1(a,b); CREATE INDEX t1i2 ON t1(a,b);
CREATE INDEX i3 ON [t1'x1](b,c); CREATE INDEX i3 ON [t1'x1](b,c);
CREATE TEMP TABLE "temp table"(e,f,g UNIQUE); CREATE $::temp TABLE "temp table"(e,f,g UNIQUE);
CREATE INDEX i2 ON [temp table](f); CREATE INDEX i2 ON [temp table](f);
INSERT INTO [temp table] VALUES(5,6,7); INSERT INTO [temp table] VALUES(5,6,7);
} }]
execsql { execsql {
SELECT 't1', * FROM t1; SELECT 't1', * FROM t1;
SELECT 't1''x1', * FROM "t1'x1"; SELECT 't1''x1', * FROM "t1'x1";
@ -62,11 +67,19 @@ do_test alter-1.1 {
} }
} {t1 1 2 t1'x1 3 4 5 6 7} } {t1 1 2 t1'x1 3 4 5 6 7}
do_test alter-1.2 { do_test alter-1.2 {
execsql [subst {
CREATE $::temp TABLE objlist(type, name, tbl_name);
INSERT INTO objlist SELECT type, name, tbl_name
FROM sqlite_master WHERE NAME!='objlist';
}]
ifcapable tempdb {
execsql {
INSERT INTO objlist SELECT type, name, tbl_name
FROM sqlite_temp_master WHERE NAME!='objlist';
}
}
execsql { execsql {
CREATE TEMP TABLE objlist(type, name, tbl_name);
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master;
INSERT INTO objlist
SELECT type, name, tbl_name FROM sqlite_temp_master WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name; SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name;
} }
} [list \ } [list \
@ -102,9 +115,14 @@ do_test alter-1.4 {
do_test alter-1.5 { do_test alter-1.5 {
execsql { execsql {
DELETE FROM objlist; DELETE FROM objlist;
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; INSERT INTO objlist SELECT type, name, tbl_name
INSERT INTO objlist FROM sqlite_master WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM sqlite_temp_master WHERE NAME!='objlist'; }
catchsql {
INSERT INTO objlist SELECT type, name, tbl_name
FROM sqlite_temp_master WHERE NAME!='objlist';
}
execsql {
SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name; SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name;
} }
} [list \ } [list \
@ -123,27 +141,33 @@ do_test alter-1.5 {
# Make sure the changes persist after restarting the database. # Make sure the changes persist after restarting the database.
# (The TEMP table will not persist, of course.) # (The TEMP table will not persist, of course.)
# #
do_test alter-1.6 { ifcapable tempdb {
db close do_test alter-1.6 {
set DB [sqlite3 db test.db] db close
set DB [sqlite3 db test.db]
execsql {
CREATE TEMP TABLE objlist(type, name, tbl_name);
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master;
INSERT INTO objlist
SELECT type, name, tbl_name FROM sqlite_temp_master
WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM objlist
ORDER BY tbl_name, type desc, name;
}
} [list \
table -t1- -t1- \
index t1i1 -t1- \
index t1i2 -t1- \
table T2 T2 \
index i3 T2 \
index {sqlite_autoindex_T2_1} T2 \
index {sqlite_autoindex_T2_2} T2 \
]
} else {
execsql { execsql {
CREATE TEMP TABLE objlist(type, name, tbl_name); DROP TABLE TempTab;
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master;
INSERT INTO objlist
SELECT type, name, tbl_name FROM sqlite_temp_master
WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM objlist
ORDER BY tbl_name, type desc, name;
} }
} [list \ }
table -t1- -t1- \
index t1i1 -t1- \
index t1i2 -t1- \
table T2 T2 \
index i3 T2 \
index {sqlite_autoindex_T2_1} T2 \
index {sqlite_autoindex_T2_2} T2 \
]
# Make sure the ALTER TABLE statements work with the # Make sure the ALTER TABLE statements work with the
# non-callback API # non-callback API
@ -155,12 +179,15 @@ do_test alter-1.7 {
} }
execsql { execsql {
DELETE FROM objlist; DELETE FROM objlist;
INSERT INTO objlist SELECT type, name, tbl_name FROM sqlite_master; INSERT INTO objlist SELECT type, name, tbl_name
INSERT INTO objlist FROM sqlite_master WHERE NAME!='objlist';
SELECT type, name, tbl_name FROM sqlite_temp_master }
WHERE NAME!='objlist'; catchsql {
SELECT type, name, tbl_name FROM objlist INSERT INTO objlist SELECT type, name, tbl_name
ORDER BY tbl_name, type desc, name; FROM sqlite_temp_master WHERE NAME!='objlist';
}
execsql {
SELECT type, name, tbl_name FROM objlist ORDER BY tbl_name, type desc, name;
} }
} [list \ } [list \
table *t1* *t1* \ table *t1* *t1* \
@ -419,12 +446,12 @@ do_test alter-3.2.10 {
} {} } {}
do_test alter-3.3.1 { do_test alter-3.3.1 {
execsql { execsql [subst {
CREATE TABLE tbl1(a, b, c); CREATE TABLE tbl1(a, b, c);
CREATE TEMP TRIGGER trig1 AFTER INSERT ON tbl1 BEGIN CREATE $::temp TRIGGER trig1 AFTER INSERT ON tbl1 BEGIN
SELECT trigfunc('trig1', new.a, new.b, new.c); SELECT trigfunc('trig1', new.a, new.b, new.c);
END; END;
} }]
} {} } {}
do_test alter-3.3.2 { do_test alter-3.3.2 {
execsql { execsql {
@ -440,11 +467,11 @@ do_test alter-3.3.3 {
set ::TRIGGER set ::TRIGGER
} {trig1 d e f} } {trig1 d e f}
do_test alter-3.3.4 { do_test alter-3.3.4 {
execsql { execsql [subst {
CREATE TEMP TRIGGER trig2 AFTER UPDATE ON tbl2 BEGIN CREATE $::temp TRIGGER trig2 AFTER UPDATE ON tbl2 BEGIN
SELECT trigfunc('trig2', new.a, new.b, new.c); SELECT trigfunc('trig2', new.a, new.b, new.c);
END; END;
} }]
} {} } {}
do_test alter-3.3.5 { do_test alter-3.3.5 {
execsql { execsql {
@ -462,9 +489,15 @@ do_test alter-3.3.6 {
do_test alter-3.3.7 { do_test alter-3.3.7 {
execsql { execsql {
DROP TABLE tbl3; DROP TABLE tbl3;
SELECT * FROM sqlite_temp_master WHERE type = 'trigger';
} }
} {} } {}
ifcapable tempdb {
do_test alter-3.3.8 {
execsql {
SELECT * FROM sqlite_temp_master WHERE type = 'trigger';
}
} {}
}
} ;# ifcapable trigger } ;# ifcapable trigger

View File

@ -13,7 +13,7 @@
# file format change that may be used in the future to implement # file format change that may be used in the future to implement
# "ALTER TABLE ... ADD COLUMN". # "ALTER TABLE ... ADD COLUMN".
# #
# $Id: alter3.test,v 1.5 2005/03/28 16:50:22 drh Exp $ # $Id: alter3.test,v 1.6 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -291,7 +291,7 @@ do_test alter3-5.99 {
# Test that the table schema is correctly reloaded when a column # Test that the table schema is correctly reloaded when a column
# is added to a table. # is added to a table.
# #
ifcapable trigger { ifcapable trigger&&tempdb {
do_test alter3-6.1 { do_test alter3-6.1 {
execsql { execsql {
CREATE TABLE t1(a, b); CREATE TABLE t1(a, b);

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.39 2005/03/15 02:04:13 drh Exp $ # $Id: attach.test,v 1.40 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -127,11 +127,13 @@ do_test attach-1.15 {
ATTACH 'test.db' as main; ATTACH 'test.db' as main;
} }
} {1 {database main is already in use}} } {1 {database main is already in use}}
do_test attach-1.16 { ifcapable tempdb {
catchsql { do_test attach-1.16 {
ATTACH 'test.db' as temp; catchsql {
} ATTACH 'test.db' as temp;
} {1 {database temp is already in use}} }
} {1 {database temp is already in use}}
}
do_test attach-1.17 { do_test attach-1.17 {
catchsql { catchsql {
ATTACH 'test.db' as MAIN; ATTACH 'test.db' as MAIN;
@ -159,7 +161,9 @@ do_test attach-1.20.2 {
} {0 main 2 db2 3 db3 4 db4 5 db6 6 db7 7 db8 8 db9 9 db10 10 db11} } {0 main 2 db2 3 db3 4 db4 5 db6 6 db7 7 db8 8 db9 9 db10 10 db11}
} ;# ifcapable schema_pragmas } ;# ifcapable schema_pragmas
integrity_check attach-1.20.3 integrity_check attach-1.20.3
execsql {select * from sqlite_temp_master} ifcapable tempdb {
execsql {select * from sqlite_temp_master}
}
do_test attach-1.21 { do_test attach-1.21 {
catchsql { catchsql {
ATTACH 'test.db' as db12; ATTACH 'test.db' as db12;
@ -190,11 +194,21 @@ do_test attach-1.26 {
DETACH main; DETACH main;
} }
} {1 {cannot detach database main}} } {1 {cannot detach database main}}
do_test attach-1.27 {
catchsql { ifcapable tempdb {
DETACH Temp; do_test attach-1.27 {
} catchsql {
} {1 {cannot detach database Temp}} DETACH Temp;
}
} {1 {cannot detach database Temp}}
} else {
do_test attach-1.27 {
catchsql {
DETACH Temp;
}
} {1 {no such database: Temp}}
}
do_test attach-1.28 { do_test attach-1.28 {
catchsql { catchsql {
DETACH db11; DETACH db11;
@ -209,9 +223,15 @@ do_test attach-1.28 {
} }
} {0 {}} } {0 {}}
ifcapable schema_pragmas { ifcapable schema_pragmas {
do_test attach-1.29 { ifcapable tempdb {
db_list db do_test attach-1.29 {
} {0 main 1 temp} db_list db
} {0 main 1 temp}
} else {
do_test attach-1.29 {
db_list db
} {0 main}
}
} ;# ifcapable schema_pragmas } ;# ifcapable schema_pragmas
ifcapable {trigger} { # Only do the following tests if triggers are enabled ifcapable {trigger} { # Only do the following tests if triggers are enabled
@ -257,11 +277,18 @@ do_test attach-2.7 {
SELECT type, name, tbl_name FROM db2.sqlite_master; SELECT type, name, tbl_name FROM db2.sqlite_master;
} }
} {table t2 t2 table tx tx trigger r1 t2} } {table t2 t2 table tx tx trigger r1 t2}
ifcapable schema_pragmas {
do_test attach-2.8 { ifcapable schema_pragmas&&tempdb {
db_list db do_test attach-2.8 {
} {0 main 1 temp 2 db2} db_list db
} ;# ifcapable schema_pragmas } {0 main 1 temp 2 db2}
} ;# ifcapable schema_pragmas&&tempdb
ifcapable schema_pragmas&&!tempdb {
do_test attach-2.8 {
db_list db
} {0 main 2 db2}
} ;# ifcapable schema_pragmas&&!tempdb
do_test attach-2.9 { do_test attach-2.9 {
execsql { execsql {
CREATE INDEX i2 ON t2(x); CREATE INDEX i2 ON t2(x);
@ -279,9 +306,15 @@ do_test attach-2.10 {
# } # }
#} {1 {database schema has changed}} #} {1 {database schema has changed}}
ifcapable schema_pragmas { ifcapable schema_pragmas {
do_test attach-2.12 { ifcapable tempdb {
db_list db do_test attach-2.12 {
} {0 main 1 temp 2 db2} db_list db
} {0 main 1 temp 2 db2}
} else {
do_test attach-2.12 {
db_list db
} {0 main 2 db2}
}
} ;# ifcapable schema_pragmas } ;# ifcapable schema_pragmas
do_test attach-2.13 { do_test attach-2.13 {
catchsql { catchsql {
@ -606,14 +639,16 @@ do_test attach-5.3 {
END; END;
} db2 } db2
} {1 {trigger r5 cannot reference objects in database orig}} } {1 {trigger r5 cannot reference objects in database orig}}
do_test attach-5.4 { ifcapable tempdb {
catchsql { do_test attach-5.4 {
CREATE TEMP TABLE t6(p,q,r); catchsql {
CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN CREATE TEMP TABLE t6(p,q,r);
SELECT 'no-op' FROM temp.t6; CREATE TRIGGER r5 AFTER INSERT ON t5 BEGIN
END; SELECT 'no-op' FROM temp.t6;
} db2 END;
} {1 {trigger r5 cannot reference objects in database temp}} } db2
} {1 {trigger r5 cannot reference objects in database temp}}
}
ifcapable subquery { ifcapable subquery {
do_test attach-5.5 { do_test attach-5.5 {
catchsql { catchsql {

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: attach2.test,v 1.31 2005/01/24 01:38:33 drh Exp $ # $Id: attach2.test,v 1.32 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -152,6 +152,16 @@ for {set i 2} {$i<=15} {incr i} {
# A procedure to verify the status of locks on a database. # A procedure to verify the status of locks on a database.
# #
proc lock_status {testnum db expected_result} { proc lock_status {testnum db expected_result} {
# If the database was compiled with OMIT_TEMPDB set, then
# the lock_status list will not contain an entry for the temp
# db. But the test code doesn't know this, so it's easiest
# to filter it out here.
ifcapable !tempdb {
set expected_result [concat \
[lrange $expected_result 0 1] \
[lrange $expected_result 4 end] \
]
}
do_test attach2-$testnum [subst { do_test attach2-$testnum [subst {
$db cache flush ;# The lock_status pragma should not be cached $db cache flush ;# The lock_status pragma should not be cached
execsql {PRAGMA lock_status} $db execsql {PRAGMA lock_status} $db

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.14 2004/11/22 08:43:32 danielk1977 Exp $ # $Id: attach3.test,v 1.15 2005/03/29 03:11:00 danielk1977 Exp $
# #
@ -189,29 +189,31 @@ do_test attach3-8.2 {
} }
} {} } {}
# Try to trick SQLite into dropping the wrong temp trigger. ifcapable tempdb {
do_test attach3-9.0 { # Try to trick SQLite into dropping the wrong temp trigger.
execsql { do_test attach3-9.0 {
CREATE TABLE main.t4(a, b, c); execsql {
CREATE TABLE aux.t4(a, b, c); CREATE TABLE main.t4(a, b, c);
CREATE TEMP TRIGGER tst_trigger BEFORE INSERT ON aux.t4 BEGIN CREATE TABLE aux.t4(a, b, c);
SELECT 'hello world'; CREATE TEMP TRIGGER tst_trigger BEFORE INSERT ON aux.t4 BEGIN
END; SELECT 'hello world';
SELECT count(*) FROM sqlite_temp_master; END;
} SELECT count(*) FROM sqlite_temp_master;
} {1} }
do_test attach3-9.1 { } {1}
execsql { do_test attach3-9.1 {
DROP TABLE main.t4; execsql {
SELECT count(*) FROM sqlite_temp_master; DROP TABLE main.t4;
} SELECT count(*) FROM sqlite_temp_master;
} {1} }
do_test attach3-9.2 { } {1}
execsql { do_test attach3-9.2 {
DROP TABLE aux.t4; execsql {
SELECT count(*) FROM sqlite_temp_master; DROP TABLE aux.t4;
} SELECT count(*) FROM sqlite_temp_master;
} {0} }
} {0}
}
} ;# endif trigger } ;# endif trigger
# Make sure the aux.sqlite_master table is read-only # Make sure the aux.sqlite_master table is read-only

File diff suppressed because it is too large Load Diff

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 testing the AUTOINCREMENT features. # focus of this script is testing the AUTOINCREMENT features.
# #
# $Id: autoinc.test,v 1.4 2005/02/17 00:03:07 drh Exp $ # $Id: autoinc.test,v 1.5 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -235,48 +235,53 @@ do_test autoinc-2.51 {
SELECT * FROM sqlite_sequence SELECT * FROM sqlite_sequence
} }
} {t1 1241} } {t1 1241}
do_test autoinc-2.52 {
execsql { ifcapable tempdb {
CREATE TEMP TABLE t2 AS SELECT y FROM t1; do_test autoinc-2.52 {
INSERT INTO t1 SELECT NULL, y+4 FROM t2; execsql {
SELECT * FROM t1; CREATE TEMP TABLE t2 AS SELECT y FROM t1;
} INSERT INTO t1 SELECT NULL, y+4 FROM t2;
} {235 1 1235 2 1240 3 1241 4 1242 5 1243 6 1244 7 1245 8} SELECT * FROM t1;
do_test autoinc-2.53 { }
execsql { } {235 1 1235 2 1240 3 1241 4 1242 5 1243 6 1244 7 1245 8}
SELECT * FROM sqlite_sequence do_test autoinc-2.53 {
} execsql {
} {t1 1245} SELECT * FROM sqlite_sequence
do_test autoinc-2.54 { }
execsql { } {t1 1245}
DELETE FROM t1; do_test autoinc-2.54 {
INSERT INTO t1 SELECT NULL, y FROM t2; execsql {
SELECT * FROM t1; DELETE FROM t1;
} INSERT INTO t1 SELECT NULL, y FROM t2;
} {1246 1 1247 2 1248 3 1249 4} SELECT * FROM t1;
do_test autoinc-2.55 { }
execsql { } {1246 1 1247 2 1248 3 1249 4}
SELECT * FROM sqlite_sequence do_test autoinc-2.55 {
} execsql {
} {t1 1249} SELECT * FROM sqlite_sequence
}
} {t1 1249}
}
# Create multiple AUTOINCREMENT tables. Make sure all sequences are # Create multiple AUTOINCREMENT tables. Make sure all sequences are
# tracked separately and do not interfere with one another. # tracked separately and do not interfere with one another.
# #
do_test autoinc-2.70 { do_test autoinc-2.70 {
execsql { catchsql {
DROP TABLE t2; DROP TABLE t2;
}
execsql {
CREATE TABLE t2(d, e INTEGER PRIMARY KEY AUTOINCREMENT, f); CREATE TABLE t2(d, e INTEGER PRIMARY KEY AUTOINCREMENT, f);
INSERT INTO t2(d) VALUES(1); INSERT INTO t2(d) VALUES(1);
SELECT * FROM sqlite_sequence; SELECT * FROM sqlite_sequence;
} }
} {t1 1249 t2 1} } [ifcapable tempdb {list t1 1249 t2 1} else {list t1 1241 t2 1}]
do_test autoinc-2.71 { do_test autoinc-2.71 {
execsql { execsql {
INSERT INTO t2(d) VALUES(2); INSERT INTO t2(d) VALUES(2);
SELECT * FROM sqlite_sequence; SELECT * FROM sqlite_sequence;
} }
} {t1 1249 t2 2} } [ifcapable tempdb {list t1 1249 t2 2} else {list t1 1241 t2 2}]
do_test autoinc-2.72 { do_test autoinc-2.72 {
execsql { execsql {
INSERT INTO t1(x) VALUES(10000); INSERT INTO t1(x) VALUES(10000);
@ -326,125 +331,129 @@ do_test autoinc-3.4 {
# AUTOINCREMENT on TEMP tables. # AUTOINCREMENT on TEMP tables.
# #
do_test autoinc-4.1 { ifcapable tempdb {
execsql { do_test autoinc-4.1 {
SELECT 1, name FROM sqlite_master WHERE type='table'; execsql {
SELECT 2, name FROM sqlite_temp_master WHERE type='table'; SELECT 1, name FROM sqlite_master WHERE type='table';
} SELECT 2, name FROM sqlite_temp_master WHERE type='table';
} {1 sqlite_sequence} }
do_test autoinc-4.2 { } {1 sqlite_sequence}
execsql { do_test autoinc-4.2 {
CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y); execsql {
CREATE TEMP TABLE t3(a INTEGER PRIMARY KEY AUTOINCREMENT, b); CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
SELECT 1, name FROM sqlite_master WHERE type='table'; CREATE TEMP TABLE t3(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
SELECT 2, name FROM sqlite_temp_master WHERE type='table'; SELECT 1, name FROM sqlite_master WHERE type='table';
} SELECT 2, name FROM sqlite_temp_master WHERE type='table';
} {1 sqlite_sequence 1 t1 2 t3 2 sqlite_sequence} }
do_test autoinc-4.3 { } {1 sqlite_sequence 1 t1 2 t3 2 sqlite_sequence}
execsql { do_test autoinc-4.3 {
SELECT 1, * FROM main.sqlite_sequence; execsql {
SELECT 2, * FROM temp.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
} SELECT 2, * FROM temp.sqlite_sequence;
} {} }
do_test autoinc-4.4 { } {}
execsql { do_test autoinc-4.4 {
INSERT INTO t1 VALUES(10,1); execsql {
INSERT INTO t3 VALUES(20,2); INSERT INTO t1 VALUES(10,1);
INSERT INTO t1 VALUES(NULL,3); INSERT INTO t3 VALUES(20,2);
INSERT INTO t3 VALUES(NULL,4); INSERT INTO t1 VALUES(NULL,3);
} INSERT INTO t3 VALUES(NULL,4);
} {} }
} {}
ifcapable compound { ifcapable compound {
do_test autoinc-4.4.1 { do_test autoinc-4.4.1 {
execsql { execsql {
SELECT * FROM t1 UNION ALL SELECT * FROM t3; SELECT * FROM t1 UNION ALL SELECT * FROM t3;
} }
} {10 1 11 3 20 2 21 4} } {10 1 11 3 20 2 21 4}
} ;# ifcapable compound } ;# ifcapable compound
do_test autoinc-4.5 { do_test autoinc-4.5 {
execsql { execsql {
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {1 t1 11 2 t3 21} } {1 t1 11 2 t3 21}
do_test autoinc-4.6 { do_test autoinc-4.6 {
execsql { execsql {
INSERT INTO t1 SELECT * FROM t3; INSERT INTO t1 SELECT * FROM t3;
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {1 t1 21 2 t3 21} } {1 t1 21 2 t3 21}
do_test autoinc-4.7 { do_test autoinc-4.7 {
execsql { execsql {
INSERT INTO t3 SELECT x+100, y FROM t1; INSERT INTO t3 SELECT x+100, y FROM t1;
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {1 t1 21 2 t3 121} } {1 t1 21 2 t3 121}
do_test autoinc-4.8 { do_test autoinc-4.8 {
execsql { execsql {
DROP TABLE t3; DROP TABLE t3;
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {1 t1 21} } {1 t1 21}
do_test autoinc-4.9 { do_test autoinc-4.9 {
execsql { execsql {
CREATE TEMP TABLE t2(p INTEGER PRIMARY KEY AUTOINCREMENT, q); CREATE TEMP TABLE t2(p INTEGER PRIMARY KEY AUTOINCREMENT, q);
INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {2 t2 21} } {2 t2 21}
do_test autoinc-4.10 { do_test autoinc-4.10 {
execsql { execsql {
DROP TABLE t2; DROP TABLE t2;
SELECT 1, * FROM main.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} }
} {} } {}
}
# Make sure AUTOINCREMENT works on ATTACH-ed tables. # Make sure AUTOINCREMENT works on ATTACH-ed tables.
# #
do_test autoinc-5.1 { ifcapable tempdb {
file delete -force test2.db do_test autoinc-5.1 {
file delete -force test2.db-journal file delete -force test2.db
sqlite3 db2 test2.db file delete -force test2.db-journal
execsql { sqlite3 db2 test2.db
CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n); execsql {
CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT); CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n);
} db2; CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT);
execsql { } db2;
ATTACH 'test2.db' as aux; execsql {
SELECT 1, * FROM main.sqlite_sequence; ATTACH 'test2.db' as aux;
SELECT 2, * FROM temp.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 3, * FROM aux.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} SELECT 3, * FROM aux.sqlite_sequence;
} {} }
do_test autoinc-5.2 { } {}
execsql { do_test autoinc-5.2 {
INSERT INTO t4 VALUES(NULL,1); execsql {
SELECT 1, * FROM main.sqlite_sequence; INSERT INTO t4 VALUES(NULL,1);
SELECT 2, * FROM temp.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 3, * FROM aux.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} SELECT 3, * FROM aux.sqlite_sequence;
} {3 t4 1} }
do_test autoinc-5.3 { } {3 t4 1}
execsql { do_test autoinc-5.3 {
INSERT INTO t5 VALUES(100,200); execsql {
SELECT * FROM sqlite_sequence INSERT INTO t5 VALUES(100,200);
} db2 SELECT * FROM sqlite_sequence
} {t4 1 t5 200} } db2
do_test autoinc-5.4 { } {t4 1 t5 200}
execsql { do_test autoinc-5.4 {
SELECT 1, * FROM main.sqlite_sequence; execsql {
SELECT 2, * FROM temp.sqlite_sequence; SELECT 1, * FROM main.sqlite_sequence;
SELECT 3, * FROM aux.sqlite_sequence; SELECT 2, * FROM temp.sqlite_sequence;
} SELECT 3, * FROM aux.sqlite_sequence;
} {3 t4 1 3 t5 200} }
} {3 t4 1 3 t5 200}
}
# Requirement REQ00310: Make sure an insert fails if the sequence is # Requirement REQ00310: Make sure an insert fails if the sequence is
# already at its maximum value. # already at its maximum value.

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 testing the callback-free C/C++ API. # focus of this script testing the callback-free C/C++ API.
# #
# $Id: capi2.test,v 1.25 2005/02/04 04:07:18 danielk1977 Exp $ # $Id: capi2.test,v 1.26 2005/03/29 03:11:00 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -97,13 +97,13 @@ do_test capi2-1.11 {
do_test capi2-2.1 { do_test capi2-2.1 {
set SQL { set SQL {
SELECT name, rowid FROM sqlite_master; SELECT name, rowid FROM sqlite_master;
SELECT name, rowid FROM sqlite_temp_master; SELECT name, rowid FROM sqlite_master WHERE 0;
-- A comment at the end -- A comment at the end
} }
set VM [sqlite3_prepare $DB $SQL -1 SQL] set VM [sqlite3_prepare $DB $SQL -1 SQL]
set SQL set SQL
} { } {
SELECT name, rowid FROM sqlite_temp_master; SELECT name, rowid FROM sqlite_master WHERE 0;
-- A comment at the end -- A comment at the end
} }
do_test capi2-2.2 { do_test capi2-2.2 {

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 built-in functions. # focus of this file is testing built-in functions.
# #
# $Id: func.test,v 1.33 2005/01/21 11:55:28 danielk1977 Exp $ # $Id: func.test,v 1.34 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -260,12 +260,22 @@ do_test func-8.2 {
SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2; SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2;
} }
} {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} } {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
do_test func-8.3 {
execsql { ifcapable tempdb {
CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC; do_test func-8.3 {
SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; execsql {
} CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC;
} {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP} SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
}
} {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
} else {
do_test func-8.3 {
execsql {
CREATE TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC;
SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
}
} {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
}
do_test func-8.4 { do_test func-8.4 {
execsql { execsql {
SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3; SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;

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 INSERT statement. # focus of this file is testing the INSERT statement.
# #
# $Id: insert.test,v 1.24 2005/03/21 01:20:58 drh Exp $ # $Id: insert.test,v 1.25 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -227,61 +227,63 @@ do_test insert-4.7 {
# Test the ability to insert from a temporary table into itself. # Test the ability to insert from a temporary table into itself.
# Ticket #275. # Ticket #275.
# #
do_test insert-5.1 { ifcapable tempdb {
execsql { do_test insert-5.1 {
CREATE TEMP TABLE t4(x); execsql {
INSERT INTO t4 VALUES(1); CREATE TEMP TABLE t4(x);
SELECT * FROM t4; INSERT INTO t4 VALUES(1);
} SELECT * FROM t4;
} {1} }
do_test insert-5.2 {
execsql {
INSERT INTO t4 SELECT x+1 FROM t4;
SELECT * FROM t4;
}
} {1 2}
ifcapable {explain} {
do_test insert-5.3 {
# verify that a temporary table is used to copy t4 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
}]
expr {[lsearch $x OpenTemp]>0}
} {1} } {1}
} do_test insert-5.2 {
execsql {
INSERT INTO t4 SELECT x+1 FROM t4;
SELECT * FROM t4;
}
} {1 2}
ifcapable {explain} {
do_test insert-5.3 {
# verify that a temporary table is used to copy t4 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
}]
expr {[lsearch $x OpenTemp]>0}
} {1}
}
do_test insert-5.4 { do_test insert-5.4 {
# Verify that table "test1" begins on page 3. This should be the same # Verify that table "test1" begins on page 3. This should be the same
# page number used by "t4" above. # page number used by "t4" above.
# #
# Update for v3 - the first table now begins on page 2 of each file, not 3. # Update for v3 - the first table now begins on page 2 of each file, not 3.
execsql { execsql {
SELECT rootpage FROM sqlite_master WHERE name='test1'; SELECT rootpage FROM sqlite_master WHERE name='test1';
}
} [expr $AUTOVACUUM?3:2]
do_test insert-5.5 {
# Verify that "t4" begins on page 3.
#
# Update for v3 - the first table now begins on page 2 of each file, not 3.
execsql {
SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
}
} {2}
do_test insert-5.6 {
# This should not use an intermediate temporary table.
execsql {
INSERT INTO t4 SELECT one FROM test1 WHERE three=7;
SELECT * FROM t4
}
} {1 2 8}
ifcapable {explain} {
do_test insert-5.7 {
# verify that no temporary table is used to copy test1 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
}]
expr {[lsearch $x OpenTemp]>0}
} {0}
} }
} [expr $AUTOVACUUM?3:2]
do_test insert-5.5 {
# Verify that "t4" begins on page 3.
#
# Update for v3 - the first table now begins on page 2 of each file, not 3.
execsql {
SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
}
} {2}
do_test insert-5.6 {
# This should not use an intermediate temporary table.
execsql {
INSERT INTO t4 SELECT one FROM test1 WHERE three=7;
SELECT * FROM t4
}
} {1 2 8}
ifcapable {explain} {
do_test insert-5.7 {
# verify that no temporary table is used to copy test1 to t4
set x [execsql {
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
}]
expr {[lsearch $x OpenTemp]>0}
} {0}
} }
# Ticket #334: REPLACE statement corrupting indices. # Ticket #334: REPLACE statement corrupting indices.

View File

@ -12,7 +12,7 @@
# focus of this file is testing the INSERT statement that takes is # focus of this file is testing the INSERT statement that takes is
# result from a SELECT. # result from a SELECT.
# #
# $Id: insert2.test,v 1.15 2005/02/08 08:42:29 danielk1977 Exp $ # $Id: insert2.test,v 1.16 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -220,29 +220,31 @@ integrity_check insert2-3.9
# Ticket #901 # Ticket #901
# #
do_test insert2-4.1 { ifcapable tempdb {
execsql { do_test insert2-4.1 {
CREATE TABLE Dependencies(depId integer primary key, execsql {
class integer, name str, flag str); CREATE TABLE Dependencies(depId integer primary key,
CREATE TEMPORARY TABLE DepCheck(troveId INT, depNum INT, class integer, name str, flag str);
flagCount INT, isProvides BOOL, class INTEGER, name STRING, CREATE TEMPORARY TABLE DepCheck(troveId INT, depNum INT,
flag STRING); flagCount INT, isProvides BOOL, class INTEGER, name STRING,
INSERT INTO DepCheck flag STRING);
VALUES(-1, 0, 1, 0, 2, 'libc.so.6', 'GLIBC_2.0'); INSERT INTO DepCheck
INSERT INTO Dependencies VALUES(-1, 0, 1, 0, 2, 'libc.so.6', 'GLIBC_2.0');
SELECT DISTINCT INSERT INTO Dependencies
NULL, SELECT DISTINCT
DepCheck.class, NULL,
DepCheck.name, DepCheck.class,
DepCheck.flag DepCheck.name,
FROM DepCheck LEFT OUTER JOIN Dependencies ON DepCheck.flag
DepCheck.class == Dependencies.class AND FROM DepCheck LEFT OUTER JOIN Dependencies ON
DepCheck.name == Dependencies.name AND DepCheck.class == Dependencies.class AND
DepCheck.flag == Dependencies.flag DepCheck.name == Dependencies.name AND
WHERE DepCheck.flag == Dependencies.flag
Dependencies.depId is NULL; WHERE
}; Dependencies.depId is NULL;
} {} };
} {}
}
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Test that the INSERT works when the SELECT statement (a) references # Test that the INSERT works when the SELECT statement (a) references

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 the sqlite_interrupt() API. # focus of this script is the sqlite_interrupt() API.
# #
# $Id: interrupt.test,v 1.10 2005/01/11 17:46:42 drh Exp $ # $Id: interrupt.test,v 1.11 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -123,36 +123,38 @@ integrity_check interrupt-2.6
# and that transaction is later rolled back, the internal schema tables do # and that transaction is later rolled back, the internal schema tables do
# not reset. # not reset.
# #
for {set i 1} {$i<50} {incr i 5} { ifcapable tempdb {
do_test interrupt-3.$i.1 { for {set i 1} {$i<50} {incr i 5} {
execsql { do_test interrupt-3.$i.1 {
BEGIN; execsql {
CREATE TEMP TABLE t2(x,y); BEGIN;
SELECT name FROM sqlite_temp_master; CREATE TEMP TABLE t2(x,y);
} SELECT name FROM sqlite_temp_master;
} {t2} }
do_test interrupt-3.$i.2 { } {t2}
set ::sqlite_interrupt_count $::i do_test interrupt-3.$i.2 {
catchsql { set ::sqlite_interrupt_count $::i
INSERT INTO t2 SELECT * FROM t1; catchsql {
} INSERT INTO t2 SELECT * FROM t1;
} {1 interrupted} }
do_test interrupt-3.$i.3 { } {1 interrupted}
execsql { do_test interrupt-3.$i.3 {
SELECT name FROM sqlite_temp_master; execsql {
} SELECT name FROM sqlite_temp_master;
} {t2} }
do_test interrupt-3.$i.4 { } {t2}
catchsql { do_test interrupt-3.$i.4 {
ROLLBACK catchsql {
} ROLLBACK
} {0 {}} }
do_test interrupt-3.$i.5 { } {0 {}}
catchsql {SELECT name FROM sqlite_temp_master}; do_test interrupt-3.$i.5 {
execsql { catchsql {SELECT name FROM sqlite_temp_master};
SELECT name FROM sqlite_temp_master; execsql {
} SELECT name FROM sqlite_temp_master;
} {} }
} {}
}
} }
# There are reports of a memory leak if an interrupt occurs during # There are reports of a memory leak if an interrupt occurs during

View File

@ -13,27 +13,46 @@
# This file implements tests for left outer joins containing WHERE # This file implements tests for left outer joins containing WHERE
# clauses that restrict the scope of the left term of the join. # clauses that restrict the scope of the left term of the join.
# #
# $Id: join4.test,v 1.3 2005/01/21 03:12:16 danielk1977 Exp $ # $Id: join4.test,v 1.4 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
do_test join4-1.1 { ifcapable tempdb {
execsql { do_test join4-1.1 {
create temp table t1(a integer, b varchar(10)); execsql {
insert into t1 values(1,'one'); create temp table t1(a integer, b varchar(10));
insert into t1 values(2,'two'); insert into t1 values(1,'one');
insert into t1 values(3,'three'); insert into t1 values(2,'two');
insert into t1 values(4,'four'); insert into t1 values(3,'three');
insert into t1 values(4,'four');
create temp table t2(x integer, y varchar(10), z varchar(10)); create temp table t2(x integer, y varchar(10), z varchar(10));
insert into t2 values(2,'niban','ok'); insert into t2 values(2,'niban','ok');
insert into t2 values(4,'yonban','err'); insert into t2 values(4,'yonban','err');
} }
execsql { execsql {
select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok' select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
} }
} {2 two 2 niban ok} } {2 two 2 niban ok}
} else {
do_test join4-1.1 {
execsql {
create table t1(a integer, b varchar(10));
insert into t1 values(1,'one');
insert into t1 values(2,'two');
insert into t1 values(3,'three');
insert into t1 values(4,'four');
create table t2(x integer, y varchar(10), z varchar(10));
insert into t2 values(2,'niban','ok');
insert into t2 values(4,'yonban','err');
}
execsql {
select * from t1 left outer join t2 on t1.a=t2.x where t2.z='ok'
}
} {2 two 2 niban ok}
}
do_test join4-1.2 { do_test join4-1.2 {
execsql { execsql {
select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok' select * from t1 left outer join t2 on t1.a=t2.x and t2.z='ok'

View File

@ -283,7 +283,7 @@ do_test lastinsert-6.4 {
# 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. # These do not run if views or triggers are disabled.
ifcapable {trigger && view} { ifcapable {trigger && view && tempdb} {
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;

View File

@ -195,7 +195,7 @@ 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. # These tests cannot run if the library does not have view support enabled.
ifcapable view { ifcapable view&&tempdb {
do_test laststmtchanges-5.1 { do_test laststmtchanges-5.1 {
catchsql { catchsql {

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 database locks. # focus of this script is database locks.
# #
# $Id: lock.test,v 1.31 2005/03/14 02:01:50 drh Exp $ # $Id: lock.test,v 1.32 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -303,42 +303,45 @@ do_test lock-5.2 {
INSERT INTO t1(a,b) SELECT 3, tx_exec('SELECT y FROM t2 LIMIT 1'); INSERT INTO t1(a,b) SELECT 3, tx_exec('SELECT y FROM t2 LIMIT 1');
} }
} {0 {}} } {0 {}}
do_test lock-5.3 {
execsql { ifcapable tempdb {
CREATE TEMP TABLE t3(x); do_test lock-5.3 {
SELECT * FROM t3; execsql {
} CREATE TEMP TABLE t3(x);
} {} SELECT * FROM t3;
do_test lock-5.4 { }
catchsql { } {}
INSERT INTO t3 SELECT tx_exec('SELECT y FROM t2 LIMIT 1'); do_test lock-5.4 {
} catchsql {
} {0 {}} INSERT INTO t3 SELECT tx_exec('SELECT y FROM t2 LIMIT 1');
do_test lock-5.5 { }
execsql { } {0 {}}
SELECT * FROM t3; do_test lock-5.5 {
} execsql {
} {8} SELECT * FROM t3;
do_test lock-5.6 { }
catchsql { } {8}
UPDATE t1 SET a=tx_exec('SELECT x FROM t2'); do_test lock-5.6 {
} catchsql {
} {0 {}} UPDATE t1 SET a=tx_exec('SELECT x FROM t2');
do_test lock-5.7 { }
execsql { } {0 {}}
SELECT * FROM t1; do_test lock-5.7 {
} execsql {
} {9 1 9 8} SELECT * FROM t1;
do_test lock-5.8 { }
catchsql { } {9 1 9 8}
UPDATE t3 SET x=tx_exec('SELECT x FROM t2'); do_test lock-5.8 {
} catchsql {
} {0 {}} UPDATE t3 SET x=tx_exec('SELECT x FROM t2');
do_test lock-5.9 { }
execsql { } {0 {}}
SELECT * FROM t3; do_test lock-5.9 {
} execsql {
} {9} SELECT * FROM t3;
}
} {9}
}
do_test lock-999.1 { do_test lock-999.1 {
rename db2 {} rename db2 {}

View File

@ -11,7 +11,7 @@
# This file attempts to check that the library can recover from a malloc() # This file attempts to check that the library can recover from a malloc()
# failure when sqlite3_global_recover() is invoked. # failure when sqlite3_global_recover() is invoked.
# #
# $Id: malloc2.test,v 1.1 2005/03/21 04:04:03 danielk1977 Exp $ # $Id: malloc2.test,v 1.2 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -35,11 +35,18 @@ ifcapable !globalrecover {
# #
proc cksum {db} { proc cksum {db} {
set ret [list] set ret [list]
set sql { ifcapable tempdb {
SELECT name FROM sqlite_master WHERE type = 'table' UNION set sql {
SELECT name FROM sqlite_temp_master WHERE type = 'table' UNION SELECT name FROM sqlite_master WHERE type = 'table' UNION
SELECT 'sqlite_master' UNION SELECT name FROM sqlite_temp_master WHERE type = 'table' UNION
SELECT 'sqlite_temp_master' SELECT 'sqlite_master' UNION
SELECT 'sqlite_temp_master'
}
} else {
set sql {
SELECT name FROM sqlite_master WHERE type = 'table' UNION
SELECT 'sqlite_master'
}
} }
foreach tbl [$db eval $sql] { foreach tbl [$db eval $sql] {
set cols [list] set cols [list]
@ -171,26 +178,28 @@ do_malloc2_test 2 -sql {
COMMIT; COMMIT;
} }
do_test malloc2.3.setup { ifcapable tempdb {
execsql { do_test malloc2.3.setup {
CREATE TEMP TABLE ghi(a, b, c);
BEGIN;
}
for {set i 0} {$i<20} {incr i} {
execsql { execsql {
INSERT INTO ghi VALUES(randstr(300,300),randstr(300,300),randstr(300,300)); CREATE TEMP TABLE ghi(a, b, c);
BEGIN;
} }
} for {set i 0} {$i<20} {incr i} {
execsql { execsql {
INSERT INTO ghi VALUES(randstr(300,300),randstr(300,300),randstr(300,300));
}
}
execsql {
COMMIT;
}
} {}
do_malloc2_test 3 -sql {
BEGIN;
CREATE INDEX ghi_i1 ON ghi(a);
UPDATE def SET a = randstr(100,100) WHERE (oid%2)==0;
UPDATE ghi SET a = randstr(100,100) WHERE (oid%2)==0;
COMMIT; COMMIT;
} }
} {}
do_malloc2_test 3 -sql {
BEGIN;
CREATE INDEX ghi_i1 ON ghi(a);
UPDATE def SET a = randstr(100,100) WHERE (oid%2)==0;
UPDATE ghi SET a = randstr(100,100) WHERE (oid%2)==0;
COMMIT;
} }
############################################################################ ############################################################################

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: misc1.test,v 1.33 2005/01/21 04:25:47 danielk1977 Exp $ # $Id: misc1.test,v 1.34 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -540,7 +540,7 @@ do_test misc1-16.6 {
} }
} {1 1 5 5 6 6} } {1 1 5 5 6 6}
ifcapable {trigger} { ifcapable trigger&&tempdb {
# Ticket #333: Temp triggers that modify persistent tables. # Ticket #333: Temp triggers that modify persistent tables.
# #
do_test misc1-17.1 { do_test misc1-17.1 {

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.20 2005/01/21 04:25:47 danielk1977 Exp $ # $Id: misc2.test,v 1.21 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -206,46 +206,48 @@ do_test misc2-8.1 {
# Ticket #513. Make sure the VDBE stack does not grow on a 3-way join. # Ticket #513. Make sure the VDBE stack does not grow on a 3-way join.
# #
do_test misc2-9.1 { ifcapable tempdb {
execsql { do_test misc2-9.1 {
BEGIN; execsql {
CREATE TABLE counts(n INTEGER PRIMARY KEY); BEGIN;
INSERT INTO counts VALUES(0); CREATE TABLE counts(n INTEGER PRIMARY KEY);
INSERT INTO counts VALUES(1); INSERT INTO counts VALUES(0);
INSERT INTO counts SELECT n+2 FROM counts; INSERT INTO counts VALUES(1);
INSERT INTO counts SELECT n+4 FROM counts; INSERT INTO counts SELECT n+2 FROM counts;
INSERT INTO counts SELECT n+8 FROM counts; INSERT INTO counts SELECT n+4 FROM counts;
COMMIT; INSERT INTO counts SELECT n+8 FROM counts;
COMMIT;
CREATE TEMP TABLE x AS CREATE TEMP TABLE x AS
SELECT dim1.n, dim2.n, dim3.n SELECT dim1.n, dim2.n, dim3.n
FROM counts AS dim1, counts AS dim2, counts AS dim3 FROM counts AS dim1, counts AS dim2, counts AS dim3
WHERE dim1.n<10 AND dim2.n<10 AND dim3.n<10; WHERE dim1.n<10 AND dim2.n<10 AND dim3.n<10;
SELECT count(*) FROM x; SELECT count(*) FROM x;
} }
} {1000} } {1000}
do_test misc2-9.2 { do_test misc2-9.2 {
execsql { execsql {
DROP TABLE x; DROP TABLE x;
CREATE TEMP TABLE x AS CREATE TEMP TABLE x AS
SELECT dim1.n, dim2.n, dim3.n SELECT dim1.n, dim2.n, dim3.n
FROM counts AS dim1, counts AS dim2, counts AS dim3 FROM counts AS dim1, counts AS dim2, counts AS dim3
WHERE dim1.n>=6 AND dim2.n>=6 AND dim3.n>=6; WHERE dim1.n>=6 AND dim2.n>=6 AND dim3.n>=6;
SELECT count(*) FROM x; SELECT count(*) FROM x;
} }
} {1000} } {1000}
do_test misc2-9.3 { do_test misc2-9.3 {
execsql { execsql {
DROP TABLE x; DROP TABLE x;
CREATE TEMP TABLE x AS CREATE TEMP TABLE x AS
SELECT dim1.n, dim2.n, dim3.n, dim4.n SELECT dim1.n, dim2.n, dim3.n, dim4.n
FROM counts AS dim1, counts AS dim2, counts AS dim3, counts AS dim4 FROM counts AS dim1, counts AS dim2, counts AS dim3, counts AS dim4
WHERE dim1.n<5 AND dim2.n<5 AND dim3.n<5 AND dim4.n<5; WHERE dim1.n<5 AND dim2.n<5 AND dim3.n<5 AND dim4.n<5;
SELECT count(*) FROM x; SELECT count(*) FROM x;
} }
} [expr 5*5*5*5] } [expr 5*5*5*5]
}
finish_test finish_test

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: misc4.test,v 1.15 2005/01/30 09:17:59 danielk1977 Exp $ # $Id: misc4.test,v 1.16 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -29,36 +29,39 @@ do_test misc4-1.1 {
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
} }
} {} } {}
do_test misc4-1.2 {
set sql {CREATE TEMP TABLE t2 AS SELECT * FROM t1}
set stmt [sqlite3_prepare $DB $sql -1 TAIL]
execsql {
BEGIN;
CREATE TABLE t3(a,b,c);
INSERT INTO t1 SELECT * FROM t1;
ROLLBACK;
}
} {}
do_test misc4-1.3 {
sqlite3_step $stmt
} SQLITE_DONE
do_test misc4-1.4 {
execsql {
SELECT * FROM temp.t2;
}
} {1}
# Drop the temporary table, then rerun the prepared statement to ifcapable tempdb {
# recreate it again. This recreates ticket #807. do_test misc4-1.2 {
# set sql {CREATE TEMP TABLE t2 AS SELECT * FROM t1}
do_test misc4-1.5 { set stmt [sqlite3_prepare $DB $sql -1 TAIL]
execsql {DROP TABLE t2} execsql {
sqlite3_reset $stmt BEGIN;
sqlite3_step $stmt CREATE TABLE t3(a,b,c);
} {SQLITE_ERROR} INSERT INTO t1 SELECT * FROM t1;
do_test misc4-1.6 { ROLLBACK;
sqlite3_finalize $stmt }
} {SQLITE_SCHEMA} } {}
do_test misc4-1.3 {
sqlite3_step $stmt
} SQLITE_DONE
do_test misc4-1.4 {
execsql {
SELECT * FROM temp.t2;
}
} {1}
# Drop the temporary table, then rerun the prepared statement to
# recreate it again. This recreates ticket #807.
#
do_test misc4-1.5 {
execsql {DROP TABLE t2}
sqlite3_reset $stmt
sqlite3_step $stmt
} {SQLITE_ERROR}
do_test misc4-1.6 {
sqlite3_finalize $stmt
} {SQLITE_SCHEMA}
}
# Prepare but do not execute various CREATE statements. Then before # Prepare but do not execute various CREATE statements. Then before
# those statements are executed, try to use the tables, indices, views, # those statements are executed, try to use the tables, indices, views,

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: pager3.test,v 1.2 2004/11/04 14:47:13 drh Exp $ # $Id: pager3.test,v 1.3 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -36,36 +36,38 @@ source $testdir/tester.tcl
# This test was added because the second truncate at NOTE (3) was not # This test was added because the second truncate at NOTE (3) was not
# occurring on early versions of SQLite 3.0. # occurring on early versions of SQLite 3.0.
# #
do_test pager3-1.1 { ifcapable tempdb {
execsql { do_test pager3-1.1 {
create table t1(a unique, b); execsql {
insert into t1 values(1, 'abcdefghijklmnopqrstuvwxyz'); create table t1(a unique, b);
insert into t1 values(2, 'abcdefghijklmnopqrstuvwxyz'); insert into t1 values(1, 'abcdefghijklmnopqrstuvwxyz');
update t1 set b=b||a||b; insert into t1 values(2, 'abcdefghijklmnopqrstuvwxyz');
update t1 set b=b||a||b; update t1 set b=b||a||b;
update t1 set b=b||a||b; update t1 set b=b||a||b;
update t1 set b=b||a||b; update t1 set b=b||a||b;
update t1 set b=b||a||b; update t1 set b=b||a||b;
update t1 set b=b||a||b; update t1 set b=b||a||b;
create temp table t2 as select * from t1; update t1 set b=b||a||b;
begin; ------- NOTE (1) create temp table t2 as select * from t1;
create table t3(x); begin; ------- NOTE (1)
} create table t3(x);
catchsql { }
insert into t1 select 4-a, b from t2; ----- NOTE (2) catchsql {
} insert into t1 select 4-a, b from t2; ----- NOTE (2)
execsql { }
rollback; ------- NOTE (3) execsql {
} rollback; ------- NOTE (3)
db close }
sqlite3 db test.db db close
set r ok sqlite3 db test.db
ifcapable {integrityck} { set r ok
set r [execsql { ifcapable {integrityck} {
pragma integrity_check; set r [execsql {
}] pragma integrity_check;
} }]
set r }
} ok set r
} ok
}
finish_test finish_test

View File

@ -12,7 +12,7 @@
# #
# This file implements tests for the PRAGMA command. # This file implements tests for the PRAGMA command.
# #
# $Id: pragma.test,v 1.34 2005/02/13 23:34:25 drh Exp $ # $Id: pragma.test,v 1.35 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -330,14 +330,16 @@ catchsql {COMMIT;}
# Test schema-query pragmas # Test schema-query pragmas
# #
ifcapable schema_pragmas { ifcapable schema_pragmas {
do_test pragma-6.1 { ifcapable tempdb {
set res {} do_test pragma-6.1 {
execsql {SELECT * FROM sqlite_temp_master} set res {}
foreach {idx name file} [execsql {pragma database_list}] { execsql {SELECT * FROM sqlite_temp_master}
lappend res $idx $name foreach {idx name file} [execsql {pragma database_list}] {
} lappend res $idx $name
set res }
} {0 main 1 temp 2 aux} set res
} {0 main 1 temp 2 aux}
}
do_test pragma-6.2 { do_test pragma-6.2 {
execsql { execsql {
pragma table_info(t2) pragma table_info(t2)
@ -387,13 +389,23 @@ ifcapable {utf16} {
} }
} {1 {unsupported encoding: bogus}} } {1 {unsupported encoding: bogus}}
} }
do_test pragma-7.3 { ifcapable tempdb {
db close do_test pragma-7.3 {
sqlite3 db test.db db close
execsql { sqlite3 db test.db
pragma lock_status; execsql {
} pragma lock_status;
} {main unlocked temp closed} }
} {main unlocked temp closed}
} else {
do_test pragma-7.3 {
db close
sqlite3 db test.db
execsql {
pragma lock_status;
}
} {main unlocked}
}
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -673,15 +685,17 @@ do_test pragma-9.8 {
PRAGMA temp_store_directory=''; PRAGMA temp_store_directory='';
} }
} {} } {}
do_test pragma-9.9 { ifcapable tempdb {
execsql { do_test pragma-9.9 {
PRAGMA temp_store_directory; execsql {
PRAGMA temp_store=FILE; PRAGMA temp_store_directory;
CREATE TEMP TABLE temp_store_directory_test(a integer); PRAGMA temp_store=FILE;
INSERT INTO temp_store_directory_test values (2); CREATE TEMP TABLE temp_store_directory_test(a integer);
SELECT * FROM temp_store_directory_test; INSERT INTO temp_store_directory_test values (2);
} SELECT * FROM temp_store_directory_test;
} {2} }
} {2}
}
do_test pragma-9.10 { do_test pragma-9.10 {
catchsql " catchsql "
PRAGMA temp_store_directory='$pwd'; PRAGMA temp_store_directory='$pwd';

View File

@ -10,7 +10,7 @@
#*********************************************************************** #***********************************************************************
# This file runs all tests. # This file runs all tests.
# #
# $Id: quick.test,v 1.34 2005/03/21 04:04:03 danielk1977 Exp $ # $Id: quick.test,v 1.35 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -19,6 +19,7 @@ proc finish_test {} {}
set ISQUICK 1 set ISQUICK 1
set EXCLUDE { set EXCLUDE {
alter.test
all.test all.test
btree2.test btree2.test
btree3.test btree3.test

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.6 2005/01/26 03:58:37 danielk1977 Exp $ # $Id: select7.test,v 1.7 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -19,18 +19,20 @@ source $testdir/tester.tcl
ifcapable compound { ifcapable compound {
# A 3-way INTERSECT. Ticket #875 # A 3-way INTERSECT. Ticket #875
do_test select7-1.1 { ifcapable tempdb {
execsql { do_test select7-1.1 {
create temp table t1(x); execsql {
insert into t1 values('amx'); create temp table t1(x);
insert into t1 values('anx'); insert into t1 values('amx');
insert into t1 values('amy'); insert into t1 values('anx');
insert into t1 values('bmy'); insert into t1 values('amy');
select * from t1 where x like 'a__' insert into t1 values('bmy');
intersect select * from t1 where x like '_m_' select * from t1 where x like 'a__'
intersect select * from t1 where x like '__x'; intersect select * from t1 where x like '_m_'
} intersect select * from t1 where x like '__x';
} {amx} }
} {amx}
}
# Nested views do not handle * properly. Ticket #826. # Nested views do not handle * properly. Ticket #826.

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: table.test,v 1.38 2005/01/24 10:26:00 danielk1977 Exp $ # $Id: table.test,v 1.39 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -349,12 +349,16 @@ do_test table-8.3.1 {
SELECT sql FROM sqlite_master WHERE name='t4"abc' SELECT sql FROM sqlite_master WHERE name='t4"abc'
} }
} {{CREATE TABLE "t4""abc"(cnt,"max(b+c)")}} } {{CREATE TABLE "t4""abc"(cnt,"max(b+c)")}}
do_test table-8.4 {
execsql2 { ifcapable tempdb {
CREATE TEMPORARY TABLE t5 AS SELECT count(*) AS [y'all] FROM [t3"xyz]; do_test table-8.4 {
SELECT * FROM t5; execsql2 {
} CREATE TEMPORARY TABLE t5 AS SELECT count(*) AS [y'all] FROM [t3"xyz];
} {y'all 1} SELECT * FROM t5;
}
} {y'all 1}
}
do_test table-8.5 { do_test table-8.5 {
db close db close
sqlite3 db test.db sqlite3 db test.db

View File

@ -12,11 +12,16 @@
# #
# This file implements tests for temporary tables and indices. # This file implements tests for temporary tables and indices.
# #
# $Id: temptable.test,v 1.14 2004/06/19 00:16:31 drh Exp $ # $Id: temptable.test,v 1.15 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
ifcapable !tempdb {
finish_test
return
}
# Create an alternative connection to the database # Create an alternative connection to the database
# #
do_test temptable-1.0 { do_test temptable-1.0 {

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 database locks. # focus of this script is database locks.
# #
# $Id: trans.test,v 1.25 2005/03/11 04:41:40 drh Exp $ # $Id: trans.test,v 1.26 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -728,41 +728,47 @@ do_test trans-7.7 {
do_test trans-7.8 { do_test trans-7.8 {
execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master}
} $checksum2 } $checksum2
do_test trans-7.9 { ifcapable tempdb {
execsql { do_test trans-7.9 {
BEGIN; execsql {
CREATE TEMP TABLE t3 AS SELECT * FROM t2; BEGIN;
INSERT INTO t2 SELECT * FROM t3; CREATE TEMP TABLE t3 AS SELECT * FROM t2;
ROLLBACK; INSERT INTO t2 SELECT * FROM t3;
SELECT md5sum(x,y,z) FROM t2; ROLLBACK;
} SELECT md5sum(x,y,z) FROM t2;
} $checksum }
} $checksum
}
do_test trans-7.10 { do_test trans-7.10 {
execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master}
} $checksum2 } $checksum2
do_test trans-7.11 { ifcapable tempdb {
execsql { do_test trans-7.11 {
BEGIN; execsql {
CREATE TEMP TABLE t3 AS SELECT * FROM t2; BEGIN;
INSERT INTO t2 SELECT * FROM t3; CREATE TEMP TABLE t3 AS SELECT * FROM t2;
DROP INDEX i2x; INSERT INTO t2 SELECT * FROM t3;
DROP INDEX i2y; DROP INDEX i2x;
CREATE INDEX i3a ON t3(x); DROP INDEX i2y;
ROLLBACK; CREATE INDEX i3a ON t3(x);
SELECT md5sum(x,y,z) FROM t2; ROLLBACK;
} SELECT md5sum(x,y,z) FROM t2;
} $checksum }
} $checksum
}
do_test trans-7.12 { do_test trans-7.12 {
execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master}
} $checksum2 } $checksum2
do_test trans-7.13 { ifcapable tempdb {
execsql { do_test trans-7.13 {
BEGIN; execsql {
DROP TABLE t2; BEGIN;
ROLLBACK; DROP TABLE t2;
SELECT md5sum(x,y,z) FROM t2; ROLLBACK;
} SELECT md5sum(x,y,z) FROM t2;
} $checksum }
} $checksum
}
do_test trans-7.14 { do_test trans-7.14 {
execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master} execsql {SELECT md5sum(type,name,tbl_name,rootpage,sql) FROM sqlite_master}
} $checksum2 } $checksum2

View File

@ -41,13 +41,16 @@ do_test trigger1-1.1.1 {
END; END;
} }
} {1 {no such table: main.no_such_table}} } {1 {no such table: main.no_such_table}}
do_test trigger1-1.1.2 {
catchsql { ifcapable tempdb {
CREATE TEMP TRIGGER trig UPDATE ON no_such_table BEGIN do_test trigger1-1.1.2 {
SELECT * from sqlite_master; catchsql {
END; CREATE TEMP TRIGGER trig UPDATE ON no_such_table BEGIN
} SELECT * from sqlite_master;
} {1 {no such table: no_such_table}} END;
}
} {1 {no such table: no_such_table}}
}
execsql { execsql {
CREATE TABLE t1(a); CREATE TABLE t1(a);
@ -107,17 +110,19 @@ do_test trigger1-1.7 {
} }
} {1 {no such trigger: tr1}} } {1 {no such trigger: tr1}}
execsql { ifcapable tempdb {
CREATE TEMP TABLE temp_table(a);
}
do_test trigger1-1.8 {
execsql { execsql {
CREATE TRIGGER temp_trig UPDATE ON temp_table BEGIN CREATE TEMP TABLE temp_table(a);
SELECT * from sqlite_master;
END;
SELECT count(*) FROM sqlite_master WHERE name = 'temp_trig';
} }
} {0} do_test trigger1-1.8 {
execsql {
CREATE TRIGGER temp_trig UPDATE ON temp_table BEGIN
SELECT * from sqlite_master;
END;
SELECT count(*) FROM sqlite_master WHERE name = 'temp_trig';
}
} {0}
}
do_test trigger1-1.9 { do_test trigger1-1.9 {
catchsql { catchsql {
@ -215,130 +220,140 @@ do_test trigger1-2.2 {
# Create a trigger that refers to a table that might not exist. # Create a trigger that refers to a table that might not exist.
# #
do_test trigger1-3.1 { ifcapable tempdb {
do_test trigger1-3.1 {
execsql {
CREATE TEMP TABLE t2(x,y);
}
catchsql {
CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
}
} {0 {}}
do_test trigger-3.2 {
catchsql {
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.3 {
db close
set rc [catch {sqlite3 db test.db} err]
if {$rc} {lappend rc $err}
set rc
} {0}
do_test trigger-3.4 {
catchsql {
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.5 {
catchsql {
CREATE TEMP TABLE t2(x,y);
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.6 {
catchsql {
DROP TRIGGER r1;
CREATE TEMP TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {0 {1 2}}
do_test trigger-3.7 {
execsql {
DROP TABLE t2;
CREATE TABLE t2(x,y);
SELECT * FROM t2;
}
} {}
# There are two versions of trigger-3.8 and trigger-3.9. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger1-3.8 {
execsql {
INSERT INTO t1 VALUES(3,4);
SELECT * FROM t1 UNION ALL SELECT * FROM t2;
}
} {1 2 3 4 3 4}
do_test trigger1-3.9 {
db close
sqlite3 db test.db
execsql {
INSERT INTO t1 VALUES(5,6);
SELECT * FROM t1 UNION ALL SELECT * FROM t2;
}
} {1 2 3 4 5 6 3 4}
} ;# ifcapable compound
ifcapable !compound {
do_test trigger1-3.8 {
execsql {
INSERT INTO t1 VALUES(3,4);
SELECT * FROM t1;
SELECT * FROM t2;
}
} {1 2 3 4 3 4}
do_test trigger1-3.9 {
db close
sqlite3 db test.db
execsql {
INSERT INTO t1 VALUES(5,6);
SELECT * FROM t1;
SELECT * FROM t2;
}
} {1 2 3 4 5 6 3 4}
} ;# ifcapable !compound
do_test trigger1-4.1 {
execsql {
CREATE TEMP TRIGGER r1 BEFORE INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
INSERT INTO t1 VALUES(7,8);
SELECT * FROM t2;
}
} {3 4 7 8}
do_test trigger1-4.2 {
sqlite3 db2 test.db
execsql {
INSERT INTO t1 VALUES(9,10);
} db2;
db2 close
execsql {
SELECT * FROM t2;
}
} {3 4 7 8}
do_test trigger1-4.3 {
execsql {
DROP TABLE t1;
SELECT * FROM t2;
};
} {3 4 7 8}
do_test trigger1-4.4 {
db close
sqlite3 db test.db
execsql {
SELECT * FROM t2;
};
} {3 4 7 8}
} else {
execsql { execsql {
CREATE TEMP TABLE t2(x,y);
}
catchsql {
CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
}
} {0 {}}
do_test trigger-3.2 {
catchsql {
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.3 {
db close
set rc [catch {sqlite3 db test.db} err]
if {$rc} {lappend rc $err}
set rc
} {0}
do_test trigger-3.4 {
catchsql {
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.5 {
catchsql {
CREATE TEMP TABLE t2(x,y);
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {1 {no such table: main.t2}}
do_test trigger-3.6 {
catchsql {
DROP TRIGGER r1;
CREATE TEMP TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t2;
}
} {0 {1 2}}
do_test trigger-3.7 {
execsql {
DROP TABLE t2;
CREATE TABLE t2(x,y); CREATE TABLE t2(x,y);
SELECT * FROM t2;
}
} {}
# There are two versions of trigger-3.8 and trigger-3.9. One that uses
# compound SELECT statements, and another that does not.
ifcapable compound {
do_test trigger-3.8 {
execsql {
INSERT INTO t1 VALUES(3,4);
SELECT * FROM t1 UNION ALL SELECT * FROM t2;
}
} {1 2 3 4 3 4}
do_test trigger-3.9 {
db close
sqlite3 db test.db
execsql {
INSERT INTO t1 VALUES(5,6);
SELECT * FROM t1 UNION ALL SELECT * FROM t2;
}
} {1 2 3 4 5 6 3 4}
} ;# ifcapable compound
ifcapable !compound {
do_test trigger-3.8 {
execsql {
INSERT INTO t1 VALUES(3,4);
SELECT * FROM t1;
SELECT * FROM t2;
}
} {1 2 3 4 3 4}
do_test trigger-3.9 {
db close
sqlite3 db test.db
execsql {
INSERT INTO t1 VALUES(5,6);
SELECT * FROM t1;
SELECT * FROM t2;
}
} {1 2 3 4 5 6 3 4}
} ;# ifcapable !compound
do_test trigger-4.1 {
execsql {
CREATE TEMP TRIGGER r1 BEFORE INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(NEW.a,NEW.b);
END;
INSERT INTO t1 VALUES(7,8);
SELECT * FROM t2;
}
} {3 4 7 8}
do_test trigger-4.2 {
sqlite3 db2 test.db
execsql {
INSERT INTO t1 VALUES(9,10);
} db2;
db2 close
execsql {
SELECT * FROM t2;
}
} {3 4 7 8}
do_test trigger-4.3 {
execsql {
DROP TABLE t1; DROP TABLE t1;
SELECT * FROM t2; INSERT INTO t2 VALUES(3, 4);
}; INSERT INTO t2 VALUES(7, 8);
} {3 4 7 8} }
do_test trigger-4.4 { }
db close
sqlite3 db test.db
execsql {
SELECT * FROM t2;
};
} {3 4 7 8}
integrity_check trigger-5.1
integrity_check trigger1-5.1
# Create a trigger with the same name as a table. Make sure the # Create a trigger with the same name as a table. Make sure the
# trigger works. Then drop the trigger. Make sure the table is # trigger works. Then drop the trigger. Make sure the table is
@ -348,10 +363,10 @@ set view_v1 {}
ifcapable view { ifcapable view {
set view_v1 {view v1} set view_v1 {view v1}
} }
do_test trigger-6.1 { do_test trigger1-6.1 {
execsql {SELECT type, name FROM sqlite_master} execsql {SELECT type, name FROM sqlite_master}
} [concat $view_v1 {table t2}] } [concat $view_v1 {table t2}]
do_test trigger-6.2 { do_test trigger1-6.2 {
execsql { execsql {
CREATE TRIGGER t2 BEFORE DELETE ON t2 BEGIN CREATE TRIGGER t2 BEFORE DELETE ON t2 BEGIN
SELECT RAISE(ABORT,'deletes are not allows'); SELECT RAISE(ABORT,'deletes are not allows');
@ -359,27 +374,27 @@ do_test trigger-6.2 {
SELECT type, name FROM sqlite_master; SELECT type, name FROM sqlite_master;
} }
} [concat $view_v1 {table t2 trigger t2}] } [concat $view_v1 {table t2 trigger t2}]
do_test trigger-6.3 { do_test trigger1-6.3 {
catchsql {DELETE FROM t2} catchsql {DELETE FROM t2}
} {1 {deletes are not allows}} } {1 {deletes are not allows}}
do_test trigger-6.4 { do_test trigger1-6.4 {
execsql {SELECT * FROM t2} execsql {SELECT * FROM t2}
} {3 4 7 8} } {3 4 7 8}
do_test trigger-6.5 { do_test trigger1-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}
} [concat $view_v1 {table t2 trigger t2}] } [concat $view_v1 {table t2 trigger t2}]
do_test trigger-6.6 { do_test trigger1-6.6 {
execsql { execsql {
DROP TRIGGER t2; DROP TRIGGER t2;
SELECT type, name FROM sqlite_master; SELECT type, name FROM sqlite_master;
} }
} [concat $view_v1 {table t2}] } [concat $view_v1 {table t2}]
do_test trigger-6.7 { do_test trigger1-6.7 {
execsql {SELECT * FROM t2} execsql {SELECT * FROM t2}
} {3 4 7 8} } {3 4 7 8}
do_test trigger-6.8 { do_test trigger1-6.8 {
db close db close
sqlite3 db test.db sqlite3 db test.db
execsql {SELECT * FROM t2} execsql {SELECT * FROM t2}
@ -390,37 +405,37 @@ integrity_check trigger-7.1
# Check to make sure the name of a trigger can be quoted so that keywords # Check to make sure the name of a trigger can be quoted so that keywords
# can be used as trigger names. Ticket #468 # can be used as trigger names. Ticket #468
# #
do_test trigger-8.1 { do_test trigger1-8.1 {
execsql { execsql {
CREATE TRIGGER 'trigger' AFTER INSERT ON t2 BEGIN SELECT 1; END; CREATE TRIGGER 'trigger' AFTER INSERT ON t2 BEGIN SELECT 1; END;
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
} }
} {trigger} } {trigger}
do_test trigger-8.2 { do_test trigger1-8.2 {
execsql { execsql {
DROP TRIGGER 'trigger'; DROP TRIGGER 'trigger';
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
} }
} {} } {}
do_test trigger-8.3 { do_test trigger1-8.3 {
execsql { execsql {
CREATE TRIGGER "trigger" AFTER INSERT ON t2 BEGIN SELECT 1; END; CREATE TRIGGER "trigger" AFTER INSERT ON t2 BEGIN SELECT 1; END;
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
} }
} {trigger} } {trigger}
do_test trigger-8.4 { do_test trigger1-8.4 {
execsql { execsql {
DROP TRIGGER "trigger"; DROP TRIGGER "trigger";
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
} }
} {} } {}
do_test trigger-8.5 { do_test trigger1-8.5 {
execsql { execsql {
CREATE TRIGGER [trigger] AFTER INSERT ON t2 BEGIN SELECT 1; END; CREATE TRIGGER [trigger] AFTER INSERT ON t2 BEGIN SELECT 1; END;
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
} }
} {trigger} } {trigger}
do_test trigger-8.6 { do_test trigger1-8.6 {
execsql { execsql {
DROP TRIGGER [trigger]; DROP TRIGGER [trigger];
SELECT name FROM sqlite_master WHERE type='trigger'; SELECT name FROM sqlite_master WHERE type='trigger';
@ -432,7 +447,7 @@ do_test trigger-8.6 {
# There are two versions of trigger-9.1 and trigger-9.2. One that uses # There are two versions of trigger-9.1 and trigger-9.2. One that uses
# compound SELECT statements, and another that does not. # compound SELECT statements, and another that does not.
ifcapable compound { ifcapable compound {
do_test trigger-9.1 { do_test trigger1-9.1 {
execsql { execsql {
CREATE TABLE t3(a,b); CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b); CREATE TABLE t4(x UNIQUE, b);
@ -443,7 +458,7 @@ do_test trigger-9.1 {
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
} }
} {1 2 99 99 1 2} } {1 2 99 99 1 2}
do_test trigger-9.2 { do_test trigger1-9.2 {
execsql { execsql {
INSERT INTO t3 VALUES(1,3); INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4; SELECT * FROM t3 UNION ALL SELECT 99, 99 UNION ALL SELECT * FROM t4;
@ -451,7 +466,7 @@ do_test trigger-9.2 {
} {1 2 1 3 99 99 1 3} } {1 2 1 3 99 99 1 3}
} }
ifcapable !compound { ifcapable !compound {
do_test trigger-9.1 { do_test trigger1-9.1 {
execsql { execsql {
CREATE TABLE t3(a,b); CREATE TABLE t3(a,b);
CREATE TABLE t4(x UNIQUE, b); CREATE TABLE t4(x UNIQUE, b);
@ -462,7 +477,7 @@ do_test trigger-9.1 {
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4; SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
} }
} {1 2 99 99 1 2} } {1 2 99 99 1 2}
do_test trigger-9.2 { do_test trigger1-9.2 {
execsql { execsql {
INSERT INTO t3 VALUES(1,3); INSERT INTO t3 VALUES(1,3);
SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4; SELECT * FROM t3; SELECT 99, 99; SELECT * FROM t4;
@ -483,93 +498,95 @@ execsql {
# Also verify that references within trigger programs are resolved at # Also verify that references within trigger programs are resolved at
# statement compile time, not trigger installation time. This means, for # statement compile time, not trigger installation time. This means, for
# example, that you can drop and re-create tables referenced by triggers. # example, that you can drop and re-create tables referenced by triggers.
do_test trigger-10.0 { ifcapable tempdb {
file delete -force test2.db do_test trigger1-10.0 {
file delete -force test2.db-journal file delete -force test2.db
execsql { file delete -force test2.db-journal
ATTACH 'test2.db' AS aux; execsql {
} ATTACH 'test2.db' AS aux;
} {} }
do_test trigger-10.1 { } {}
execsql { do_test trigger1-10.1 {
CREATE TABLE main.t4(a, b, c); execsql {
CREATE TABLE temp.t4(a, b, c); CREATE TABLE main.t4(a, b, c);
CREATE TABLE aux.t4(a, b, c); CREATE TABLE temp.t4(a, b, c);
CREATE TABLE insert_log(db, a, b, c); CREATE TABLE aux.t4(a, b, c);
} CREATE TABLE insert_log(db, a, b, c);
} {} }
do_test trigger-10.2 { } {}
execsql { do_test trigger1-10.2 {
CREATE TEMP TRIGGER trig1 AFTER INSERT ON main.t4 BEGIN execsql {
INSERT INTO insert_log VALUES('main', new.a, new.b, new.c); CREATE TEMP TRIGGER trig1 AFTER INSERT ON main.t4 BEGIN
END; INSERT INTO insert_log VALUES('main', new.a, new.b, new.c);
CREATE TEMP TRIGGER trig2 AFTER INSERT ON temp.t4 BEGIN END;
INSERT INTO insert_log VALUES('temp', new.a, new.b, new.c); CREATE TEMP TRIGGER trig2 AFTER INSERT ON temp.t4 BEGIN
END; INSERT INTO insert_log VALUES('temp', new.a, new.b, new.c);
CREATE TEMP TRIGGER trig3 AFTER INSERT ON aux.t4 BEGIN END;
INSERT INTO insert_log VALUES('aux', new.a, new.b, new.c); CREATE TEMP TRIGGER trig3 AFTER INSERT ON aux.t4 BEGIN
END; INSERT INTO insert_log VALUES('aux', new.a, new.b, new.c);
} END;
} {} }
do_test trigger-10.3 { } {}
execsql { do_test trigger1-10.3 {
INSERT INTO main.t4 VALUES(1, 2, 3); execsql {
INSERT INTO temp.t4 VALUES(4, 5, 6); INSERT INTO main.t4 VALUES(1, 2, 3);
INSERT INTO aux.t4 VALUES(7, 8, 9); INSERT INTO temp.t4 VALUES(4, 5, 6);
} INSERT INTO aux.t4 VALUES(7, 8, 9);
} {} }
do_test trigger-10.4 { } {}
execsql { do_test trigger1-10.4 {
SELECT * FROM insert_log; execsql {
} SELECT * FROM insert_log;
} {main 1 2 3 temp 4 5 6 aux 7 8 9} }
do_test trigger-10.5 { } {main 1 2 3 temp 4 5 6 aux 7 8 9}
execsql { do_test trigger1-10.5 {
BEGIN; execsql {
INSERT INTO main.t4 VALUES(1, 2, 3); BEGIN;
INSERT INTO temp.t4 VALUES(4, 5, 6); INSERT INTO main.t4 VALUES(1, 2, 3);
INSERT INTO aux.t4 VALUES(7, 8, 9); INSERT INTO temp.t4 VALUES(4, 5, 6);
ROLLBACK; INSERT INTO aux.t4 VALUES(7, 8, 9);
} ROLLBACK;
} {} }
do_test trigger-10.6 { } {}
execsql { do_test trigger1-10.6 {
SELECT * FROM insert_log; execsql {
} SELECT * FROM insert_log;
} {main 1 2 3 temp 4 5 6 aux 7 8 9} }
do_test trigger-10.7 { } {main 1 2 3 temp 4 5 6 aux 7 8 9}
execsql { do_test trigger1-10.7 {
DELETE FROM insert_log; execsql {
INSERT INTO main.t4 VALUES(11, 12, 13); DELETE FROM insert_log;
INSERT INTO temp.t4 VALUES(14, 15, 16); INSERT INTO main.t4 VALUES(11, 12, 13);
INSERT INTO aux.t4 VALUES(17, 18, 19); INSERT INTO temp.t4 VALUES(14, 15, 16);
} INSERT INTO aux.t4 VALUES(17, 18, 19);
} {} }
do_test trigger-10.8 { } {}
execsql { do_test trigger1-10.8 {
SELECT * FROM insert_log; execsql {
} SELECT * FROM insert_log;
} {main 11 12 13 temp 14 15 16 aux 17 18 19} }
do_test trigger-10.8 { } {main 11 12 13 temp 14 15 16 aux 17 18 19}
# Drop and re-create the insert_log table in a different database. Note do_test trigger1-10.8 {
# that we can change the column names because the trigger programs don't # Drop and re-create the insert_log table in a different database. Note
# use them explicitly. # that we can change the column names because the trigger programs don't
execsql { # use them explicitly.
DROP TABLE insert_log; execsql {
CREATE TABLE aux.insert_log(db, d, e, f); DROP TABLE insert_log;
} CREATE TABLE aux.insert_log(db, d, e, f);
} {} }
do_test trigger-10.10 { } {}
execsql { do_test trigger1-10.10 {
INSERT INTO main.t4 VALUES(21, 22, 23); execsql {
INSERT INTO temp.t4 VALUES(24, 25, 26); INSERT INTO main.t4 VALUES(21, 22, 23);
INSERT INTO aux.t4 VALUES(27, 28, 29); INSERT INTO temp.t4 VALUES(24, 25, 26);
} INSERT INTO aux.t4 VALUES(27, 28, 29);
} {} }
do_test trigger-10.11 { } {}
execsql { do_test trigger1-10.11 {
SELECT * FROM insert_log; execsql {
} SELECT * FROM insert_log;
} {main 21 22 23 temp 24 25 26 aux 27 28 29} }
} {main 21 22 23 temp 24 25 26 aux 27 28 29}
}
finish_test finish_test

View File

@ -57,15 +57,20 @@ ifcapable {!trigger} {
# 1. # 1.
ifcapable subquery { ifcapable subquery {
set ii 0 set ii 0
foreach tbl_defn { set tbl_definitions [list \
{CREATE TEMP TABLE tbl (a, b);} {CREATE TABLE tbl (a, b);} \
{CREATE TABLE tbl (a, b);} {CREATE TABLE tbl (a INTEGER PRIMARY KEY, b);} \
{CREATE TABLE tbl (a INTEGER PRIMARY KEY, b);} {CREATE TABLE tbl (a, b PRIMARY KEY);} \
{CREATE TEMPORARY TABLE tbl (a INTEGER PRIMARY KEY, b);} {CREATE TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);} \
{CREATE TABLE tbl (a, b PRIMARY KEY);} ]
{CREATE TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);} ifcapable tempdb {
{CREATE TEMP TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);} lappend tbl_definitions \
} { {CREATE TEMP TABLE tbl (a, b); CREATE INDEX tbl_idx ON tbl(b);}
lappend tbl_definitions {CREATE TEMP TABLE tbl (a, b);}
lappend tbl_definitions \
{CREATE TEMPORARY TABLE tbl (a INTEGER PRIMARY KEY, b);}
}
foreach tbl_defn $tbl_definitions {
incr ii incr ii
catchsql { DROP INDEX tbl_idx; } catchsql { DROP INDEX tbl_idx; }
catchsql { catchsql {

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.34 2005/02/12 00:19:30 drh Exp $ # $Id: vacuum.test,v 1.35 2005/03/29 03:11:00 danielk1977 Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -239,11 +239,12 @@ do_test vacuum-5.1 {
CREATE VIEW viewTest AS SELECT * FROM Test; CREATE VIEW viewTest AS SELECT * FROM Test;
BEGIN; BEGIN;
CREATE TEMP TABLE tempTest (TestID int primary key, Test2 int NULL); CREATE TABLE tempTest (TestID int primary key, Test2 int NULL);
INSERT INTO tempTest SELECT TestID, 1 FROM Test; INSERT INTO tempTest SELECT TestID, 1 FROM Test;
DROP TABLE Test; DROP TABLE Test;
CREATE TABLE Test(TestID int primary key, Test2 int NULL); CREATE TABLE Test(TestID int primary key, Test2 int NULL);
INSERT INTO Test SELECT * FROM tempTest; INSERT INTO Test SELECT * FROM tempTest;
DROP TABLE tempTest;
COMMIT; COMMIT;
VACUUM; VACUUM;
} }