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

All tests pass even if OMIT_TRIGGER is defined. (CVS 2053)

FossilOrigin-Name: c33b3a613751057e8a46fdcd428b8448329d414d
This commit is contained in:
drh
2004-11-04 04:42:28 +00:00
parent bf8aa33bba
commit 798da52ce7
20 changed files with 349 additions and 261 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\s#ifdef\sin\sutil.c.\s\sTicket\s#984.\s(CVS\s2052) C All\stests\spass\seven\sif\sOMIT_TRIGGER\sis\sdefined.\s(CVS\s2053)
D 2004-11-04T04:34:15 D 2004-11-04T04:42:28
F Makefile.in c4d2416860f472a1e3393714d0372074197565df F Makefile.in c4d2416860f472a1e3393714d0372074197565df
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@ -33,12 +33,12 @@ F src/btree.c 93163198e6fb666b92c893fba5edb3ef6f335c0f
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
F src/build.c bb896c5f85ab749d17ae5d730235134c12c08033 F src/build.c bb896c5f85ab749d17ae5d730235134c12c08033
F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad
F src/delete.c cf0efbef1f42d4eec385a3f59af2b37a5e232074 F src/delete.c 52980e594e69e80374fb928fe611d5f75ca4e390
F src/expr.c 3a43e508a3dc213703808bbcbb17633b88b57d17 F src/expr.c 3a43e508a3dc213703808bbcbb17633b88b57d17
F src/func.c 600e506bccf7648df8ad03efb417560d0f7ad4c1 F src/func.c 600e506bccf7648df8ad03efb417560d0f7ad4c1
F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 64a3716522cbc81d91176eac0d944cc14be6236c F src/insert.c 17f66e2c32e551122f45cea11db3e664471418d6
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
F src/main.c ba1b26f03af4b7f8be3394748123dd671b9ea147 F src/main.c ba1b26f03af4b7f8be3394748123dd671b9ea147
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
@ -71,7 +71,7 @@ F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1 F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
F src/tokenize.c bf9de9689b3bb813d65784bf54472804bf9595e6 F src/tokenize.c bf9de9689b3bb813d65784bf54472804bf9595e6
F src/trigger.c f9a0a8d3a87238de1a934eeb7d0b6b1f13e6a55b F src/trigger.c f9a0a8d3a87238de1a934eeb7d0b6b1f13e6a55b
F src/update.c ee15b7ba712c2292802eba2d465f039b5deada39 F src/update.c 7b17b281d600bf3e220b3c5718e0883442dee722
F src/utf.c f4f83acd73389090e32d6589d307fc55d794c7ed F src/utf.c f4f83acd73389090e32d6589d307fc55d794c7ed
F src/util.c 005fdf2d008f3429d081766ad6098fdd86d8d8e6 F src/util.c 005fdf2d008f3429d081766ad6098fdd86d8d8e6
F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60 F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60
@ -83,9 +83,9 @@ F src/vdbeaux.c 544ff66308d3184b519decc731abb65c5233bc2d
F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56 F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56
F src/where.c 6e637a6b3e61fe3104adc4e5caa4738bf6570daa F src/where.c 6e637a6b3e61fe3104adc4e5caa4738bf6570daa
F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
F test/attach.test 6ad560eb3e77751a4faecd77da09deac9e38cc41 F test/attach.test ff7fc16b4518a448fed47dfb3694bf57f522d552
F test/attach2.test f7795123d3051ace1672b6d23973da6435de3745 F test/attach2.test f7795123d3051ace1672b6d23973da6435de3745
F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e F test/attach3.test 742c932d7130e0e699a5d9f265cb831e0a824633
F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21 F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21
F test/autovacuum.test 9211914801ad35ad8f0fc15711b12461850ef2ac F test/autovacuum.test 9211914801ad35ad8f0fc15711b12461850ef2ac
F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f
@ -106,13 +106,13 @@ F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036
F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50 F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50
F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b
F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5 F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87 F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
F test/corrupt.test 0080ddcece23e8ba47c44608c4fb73fd4d1d8ce2 F test/corrupt.test 0080ddcece23e8ba47c44608c4fb73fd4d1d8ce2
F test/crash.test a3f6d27f7cb7f7bd752461db1e14f7c781ecedc3 F test/crash.test a3f6d27f7cb7f7bd752461db1e14f7c781ecedc3
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/date.test dda578ec1857837156bd8b32f8e09d81d7d7881c F test/date.test dda578ec1857837156bd8b32f8e09d81d7d7881c
F test/delete.test ec0b455f2dcc0e189d96ee438438ba026c4e51d8 F test/delete.test fc29491f6a7ac899ce29f4549a104809e245d9a6
F test/delete2.test 050a3a6e8ea0f83aed817d164b16af2a499fb452 F test/delete2.test 050a3a6e8ea0f83aed817d164b16af2a499fb452
F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0 F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0
F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961 F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
@ -123,30 +123,30 @@ F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05 F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
F test/index.test 83f5c232948801da2d9b7c603362d8e0313485bc F test/index.test 4098cd020180bec286ef1a96bca256e76cc7b654
F test/insert.test c571223b499961d843ce0ab4709c87fa60ab2425 F test/insert.test c571223b499961d843ce0ab4709c87fa60ab2425
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
F test/interrupt.test 6b6b8b86cdeb66d5488bd1db74b4bb3c46e4f565 F test/interrupt.test 5c336baaf810e5f7a91d2f01e2cafca480885dfe
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194 F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c
F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd
F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8 F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3 F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
F test/lastinsert.test 31382f88b9b0270333ac9e4a17f2c2f4732da718 F test/lastinsert.test 09ac3a359ced3d4510feccc0dcbae3d80e449cf9
F test/laststmtchanges.test 417aa27eb2b5cdfafb46e390e2c9ddd0a20eba43 F test/laststmtchanges.test 9cb56c5935103cacd0070d9d25d8dde322928db1
F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35 F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35
F test/lock.test 7cb9395919a0986ee4dd08bd49d34df93c8fc4fe F test/lock.test 7cb9395919a0986ee4dd08bd49d34df93c8fc4fe
F test/lock2.test 2213590d442147d09fd2334c905a755586c1c398 F test/lock2.test 2213590d442147d09fd2334c905a755586c1c398
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/main.test add6cd4fc1264becd3d195431073f202738af317 F test/main.test 5f9deae11b93336da1ccc5f91cf8be075c91ddf1
F test/malloc.test 769b240d89a7ef3320d88919fdb6765f9395a51f F test/malloc.test 769b240d89a7ef3320d88919fdb6765f9395a51f
F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027 F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027
F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29 F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29
F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6 F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6
F test/misc1.test 1a20ea722dff15155e93948dc4ac3e8d80fec386 F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a
F test/misc2.test 703734f5817215ca54e364833b3bf5ff36fcc21e F test/misc2.test 9d9403f7e6092699f3f92bb1e26ff55165528e7c
F test/misc3.test db48619711950a1098b9547a8091cbb440b22e54 F test/misc3.test 8c83c3810d6254d9d63b4cbf3941c7b9523c236d
F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622 F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622
F test/misuse.test fcd9e7cec6ecccc34822584aec6b4e31f13629e1 F test/misuse.test fcd9e7cec6ecccc34822584aec6b4e31f13629e1
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
@ -154,14 +154,14 @@ F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
F test/pager.test 394455707a079804e8a4e431d12edce831a065f0 F test/pager.test 394455707a079804e8a4e431d12edce831a065f0
F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377 F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377
F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b
F test/pagesize.test 86e14e54b608c00ecf86d14504ad8fed1e4e0064 F test/pagesize.test 2050bb574c43f9143d283d6bcd37fa1eb73f0e49
F test/pragma.test ed8156b5ef3a82ff7be6bd814b3715079ea5a6b0 F test/pragma.test ed8156b5ef3a82ff7be6bd814b3715079ea5a6b0
F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57 F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x
F test/quick.test 2dca186ebd5c418a7699944ba3b5e437d765eddd F test/quick.test 2dca186ebd5c418a7699944ba3b5e437d765eddd
F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62 F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62
F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
F test/rowid.test b3d059f5c8d8874fa1c31030e0636f67405d20ea F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f
F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685 F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
@ -191,7 +191,7 @@ F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217 F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558 F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
F test/vacuum.test 98831051cff8e6084f22785c79bdb10080c42dde F test/vacuum.test fea17dd67231ced71ef71ac15f01760593af5ff6
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 2ec8fd4f3809243ad12667932071d536d1ba6850 F test/view.test 2ec8fd4f3809243ad12667932071d536d1ba6850
F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb
@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P 571de52376f52999268ba5e0cd05c6c6eff1ebbf P da045bd183335a112f9a6c805c12efe12d0a25ca
R 88bc900ed597200e93ade91a1a123d03 R 3020d6f48bce04fcef7f5133e21d3db2
U drh U drh
Z 7327d11a71a1235a378656ac4c026c33 Z 625b1d515abab0cebf7c5f6337f4ff8c

View File

@ -1 +1 @@
da045bd183335a112f9a6c805c12efe12d0a25ca c33b3a613751057e8a46fdcd428b8448329d414d

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements. ** to handle DELETE FROM statements.
** **
** $Id: delete.c,v 1.84 2004/10/31 02:22:49 drh Exp $ ** $Id: delete.c,v 1.85 2004/11/04 04:42:28 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -81,13 +81,15 @@ void sqlite3DeleteFrom(
Index *pIdx; /* For looping over indices of the table */ Index *pIdx; /* For looping over indices of the table */
int iCur; /* VDBE Cursor number for pTab */ int iCur; /* VDBE Cursor number for pTab */
sqlite3 *db; /* Main database structure */ sqlite3 *db; /* Main database structure */
int isView; /* True if attempting to delete from a view */
AuthContext sContext; /* Authorization context */ AuthContext sContext; /* Authorization context */
int oldIdx = -1; /* Cursor for the OLD table of AFTER triggers */
#ifndef SQLITE_OMIT_TRIGGER
int isView; /* True if attempting to delete from a view */
int row_triggers_exist = 0; /* True if any triggers exist */ int row_triggers_exist = 0; /* True if any triggers exist */
int before_triggers; /* True if there are BEFORE triggers */ int before_triggers; /* True if there are BEFORE triggers */
int after_triggers; /* True if there are AFTER triggers */ int after_triggers; /* True if there are AFTER triggers */
int oldIdx = -1; /* Cursor for the OLD table of AFTER triggers */ #endif
sContext.pParse = 0; sContext.pParse = 0;
if( pParse->nErr || sqlite3_malloc_failed ){ if( pParse->nErr || sqlite3_malloc_failed ){
@ -271,7 +273,7 @@ void sqlite3DeleteFrom(
sqlite3VdbeAddOp(v, OP_Close, iCur, 0); sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
} }
sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1, (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1,
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default, oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
addr); addr);
} }
@ -305,7 +307,7 @@ void sqlite3DeleteFrom(
} }
sqlite3VdbeAddOp(v, OP_Close, iCur, 0); sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
} }
sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1, (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1,
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default, oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
addr); addr);
} }

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite. ** to handle INSERT statements in SQLite.
** **
** $Id: insert.c,v 1.120 2004/10/31 02:22:49 drh Exp $ ** $Id: insert.c,v 1.121 2004/11/04 04:42:28 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -188,12 +188,14 @@ void sqlite3Insert(
int iCleanup = 0; /* Address of the cleanup code */ int iCleanup = 0; /* Address of the cleanup code */
int iInsertBlock = 0; /* Address of the subroutine used to insert data */ int iInsertBlock = 0; /* Address of the subroutine used to insert data */
int iCntMem = 0; /* Memory cell used for the row counter */ int iCntMem = 0; /* Memory cell used for the row counter */
int isView; /* True if attempting to insert into a view */ int newIdx = -1; /* Cursor for the NEW table */
#ifndef SQLITE_OMIT_TRIGGER
int isView; /* True if attempting to insert into a view */
int row_triggers_exist = 0; /* True if there are FOR EACH ROW triggers */ int row_triggers_exist = 0; /* True if there are FOR EACH ROW triggers */
int before_triggers; /* True if there are BEFORE triggers */ int before_triggers; /* True if there are BEFORE triggers */
int after_triggers; /* True if there are AFTER triggers */ int after_triggers; /* True if there are AFTER triggers */
int newIdx = -1; /* Cursor for the NEW table */ #endif
if( pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup; if( pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup;
db = pParse->db; db = pParse->db;

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle UPDATE statements. ** to handle UPDATE statements.
** **
** $Id: update.c,v 1.91 2004/10/31 02:22:49 drh Exp $ ** $Id: update.c,v 1.92 2004/11/04 04:42:28 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -48,12 +48,14 @@ void sqlite3Update(
int chngRecno; /* True if the record number is being changed */ int chngRecno; /* True if the record number is being changed */
Expr *pRecnoExpr = 0; /* Expression defining the new record number */ Expr *pRecnoExpr = 0; /* Expression defining the new record number */
int openAll = 0; /* True if all indices need to be opened */ int openAll = 0; /* True if all indices need to be opened */
int isView; /* Trying to update a view */
AuthContext sContext; /* The authorization context */ AuthContext sContext; /* The authorization context */
#ifndef SQLITE_OMIT_TRIGGER
int isView; /* Trying to update a view */
int before_triggers; /* True if there are any BEFORE triggers */ int before_triggers; /* True if there are any BEFORE triggers */
int after_triggers; /* True if there are any AFTER triggers */ int after_triggers; /* True if there are any AFTER triggers */
int row_triggers_exist = 0; /* True if any row triggers exist */ int row_triggers_exist = 0; /* True if any row triggers exist */
#endif
int newIdx = -1; /* index of trigger "new" temp table */ int newIdx = -1; /* index of trigger "new" temp table */
int oldIdx = -1; /* index of trigger "old" temp table */ int oldIdx = -1; /* index of trigger "old" temp table */

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.27 2004/10/31 02:22:50 drh Exp $ # $Id: attach.test,v 1.28 2004/11/04 04:42:28 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -454,11 +454,11 @@ do_test attach-4.5 {
SELECT * FROM db2.t3; SELECT * FROM db2.t3;
} }
} {1 2 9 10} } {1 2 9 10}
execsql {
DETACH db2;
}
ifcapable {trigger} { ifcapable {trigger} {
do_test attach-4.6 { do_test attach-4.6 {
execsql {
DETACH db2;
}
execsql { execsql {
CREATE TABLE t4(x); CREATE TABLE t4(x);
CREATE TRIGGER t3r3 AFTER INSERT ON t3 BEGIN CREATE TRIGGER t3r3 AFTER INSERT ON t3 BEGIN
@ -479,6 +479,23 @@ ifcapable {trigger} {
} }
} {main.11} } {main.11}
} }
ifcapable {!trigger} {
# When we do not have trigger support, set up the table like they
# would have been had triggers been there. The tests that follow need
# this setup.
execsql {
CREATE TABLE t4(x);
INSERT INTO t3 VALUES(6,7);
INSERT INTO t4 VALUES('db2.6');
INSERT INTO t4 VALUES('db2.13');
} db2
execsql {
CREATE TABLE t4(y);
INSERT INTO main.t3 VALUES(11,12);
INSERT INTO t4 VALUES('main.11');
}
}
# This one is tricky. On the UNION ALL select, we have to make sure # This one is tricky. On the UNION ALL select, we have to make sure
# the schema for both main and db2 is valid before starting to execute # the schema for both main and db2 is valid before starting to execute
@ -496,6 +513,7 @@ do_test attach-4.8 {
} {db2.6 db2.13 main.11} } {db2.6 db2.13 main.11}
do_test attach-4.9 { do_test attach-4.9 {
ifcapable {!trigger} {execsql {INSERT INTO main.t4 VALUES('main.15')}}
execsql { execsql {
INSERT INTO main.t3 VALUES(15,16); INSERT INTO main.t3 VALUES(15,16);
SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4; SELECT * FROM db2.t4 UNION ALL SELECT * FROM main.t4;
@ -530,6 +548,7 @@ do_test attach-4.13 {
# Tests for the sqliteFix...() routines in attach.c # Tests for the sqliteFix...() routines in attach.c
# #
ifcapable {trigger} {
do_test attach-5.1 { do_test attach-5.1 {
db close db close
sqlite3 db test.db sqlite3 db test.db
@ -609,6 +628,7 @@ do_test attach-5.9 {
END; END;
} db2 } db2
} {1 {trigger r5 cannot reference objects in database temp}} } {1 {trigger r5 cannot reference objects in database temp}}
} ;# endif trigger
# Check to make sure we get a sensible error if unable to open # Check to make sure we get a sensible error if unable to open
# the file that we are trying to attach. # the file that we are trying to attach.

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.9 2004/07/19 00:56:24 drh Exp $ # $Id: attach3.test,v 1.10 2004/11/04 04:42:28 drh Exp $
# #
@ -153,6 +153,7 @@ do_test attach3-6.2 {
} }
} {} } {}
ifcapable {trigger} {
# Create a trigger in the auxilary database. # Create a trigger in the auxilary database.
do_test attach3-7.1 { do_test attach3-7.1 {
execsql { execsql {
@ -211,6 +212,7 @@ do_test attach3-9.2 {
SELECT count(*) FROM sqlite_temp_master; SELECT count(*) FROM sqlite_temp_master;
} }
} {0} } {0}
} ;# endif trigger
# Make sure the aux.sqlite_master table is read-only # Make sure the aux.sqlite_master table is read-only
do_test attach3-10.0 { do_test attach3-10.0 {

View File

@ -12,11 +12,19 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script is collation sequences in concert with triggers. # focus of this script is collation sequences in concert with triggers.
# #
# $Id: collate6.test,v 1.1 2004/06/11 10:51:41 danielk1977 Exp $ # $Id: collate6.test,v 1.2 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# There are no tests in this file that will work without
# trigger support.
#
ifcapable {!trigger} {
finish_test
return
}
# Create a case-insensitive collation type NOCASE for use in testing. # Create a case-insensitive collation type NOCASE for use in testing.
# Normally, capital letters are less than their lower-case counterparts. # Normally, capital letters are less than their lower-case counterparts.
db collate NOCASE nocase_collate db collate NOCASE nocase_collate
@ -101,6 +109,3 @@ do_test collate6-1.9 {
finish_test finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the DELETE FROM statement. # focus of this file is testing the DELETE FROM statement.
# #
# $Id: delete.test,v 1.17 2004/07/15 20:08:39 drh Exp $ # $Id: delete.test,v 1.18 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -216,44 +216,49 @@ do_test delete-7.1 {
SELECT * FROM t3; SELECT * FROM t3;
} }
} {1 2 3 4} } {1 2 3 4}
do_test delete-7.2 { ifcapable {trigger} {
execsql { do_test delete-7.2 {
CREATE TABLE cnt(del); execsql {
INSERT INTO cnt VALUES(0); CREATE TABLE cnt(del);
CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN INSERT INTO cnt VALUES(0);
UPDATE cnt SET del=del+1; CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN
END; UPDATE cnt SET del=del+1;
DELETE FROM t3 WHERE a<2; END;
SELECT * FROM t3; DELETE FROM t3 WHERE a<2;
} SELECT * FROM t3;
} {2 3 4} }
do_test delete-7.3 { } {2 3 4}
execsql { do_test delete-7.3 {
SELECT * FROM cnt; execsql {
} SELECT * FROM cnt;
} {1} }
do_test delete-7.4 { } {1}
execsql { do_test delete-7.4 {
DELETE FROM t3; execsql {
SELECT * FROM t3; DELETE FROM t3;
} SELECT * FROM t3;
} {} }
do_test delete-7.5 { } {}
execsql { do_test delete-7.5 {
SELECT * FROM cnt; execsql {
} SELECT * FROM cnt;
} {4} }
do_test delete-7.6 { } {4}
execsql { do_test delete-7.6 {
INSERT INTO t3 VALUES(1); execsql {
INSERT INTO t3 SELECT a+1 FROM t3; INSERT INTO t3 VALUES(1);
INSERT INTO t3 SELECT a+2 FROM t3; INSERT INTO t3 SELECT a+1 FROM t3;
CREATE TABLE t4 AS SELECT * FROM t3; INSERT INTO t3 SELECT a+2 FROM t3;
PRAGMA count_changes=ON; CREATE TABLE t4 AS SELECT * FROM t3;
DELETE FROM t3; PRAGMA count_changes=ON;
DELETE FROM t4; DELETE FROM t3;
} DELETE FROM t4;
} {4 4} }
} {4 4}
} ;# endif trigger
ifcapable {!trigger} {
execsql {DELETE FROM t3}
}
integrity_check delete-7.7 integrity_check delete-7.7
# Make sure error messages are consistent when attempting to delete # Make sure error messages are consistent when attempting to delete

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement. # focus of this file is testing the CREATE INDEX statement.
# #
# $Id: index.test,v 1.33 2004/11/03 16:27:02 drh Exp $ # $Id: index.test,v 1.34 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -598,11 +598,13 @@ do_test index-18.3 {
CREATE VIEW sqlite_v1 AS SELECT * FROM t7; CREATE VIEW sqlite_v1 AS SELECT * FROM t7;
} }
} {1 {object name reserved for internal use: sqlite_v1}} } {1 {object name reserved for internal use: sqlite_v1}}
do_test index-18.4 { ifcapable {trigger} {
catchsql { do_test index-18.4 {
CREATE TRIGGER sqlite_tr1 BEFORE INSERT ON t7 BEGIN SELECT 1; END; catchsql {
} CREATE TRIGGER sqlite_tr1 BEFORE INSERT ON t7 BEGIN SELECT 1; END;
} {1 {object name reserved for internal use: sqlite_tr1}} }
} {1 {object name reserved for internal use: sqlite_tr1}}
}
do_test index-18.5 { do_test index-18.5 {
execsql { execsql {
DROP TABLE t7; DROP TABLE t7;

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.5 2004/10/30 20:23:10 drh Exp $ # $Id: interrupt.test,v 1.6 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -94,7 +94,9 @@ do_test interrrupt-2.1 {
} 64 } 64
set origsize [file size test.db] set origsize [file size test.db]
set cksum [db eval {SELECT md5sum(a || b) FROM t1}] set cksum [db eval {SELECT md5sum(a || b) FROM t1}]
interrupt_test interrupt-2.2 {VACUUM} {} 100 ifcapable {vacuum} {
interrupt_test interrupt-2.2 {VACUUM} {} 100
}
do_test interrupt-2.3 { do_test interrupt-2.3 {
execsql { execsql {
SELECT md5sum(a || b) FROM t1; SELECT md5sum(a || b) FROM t1;

View File

@ -61,6 +61,14 @@ do_test lastinsert-1.4 {
} }
} {0 3} } {0 3}
# All remaining tests involve triggers. Skip them if triggers are not
# supported in this build.
#
ifcapable {!trigger} {
finish_test
return
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 2.x - tests with after insert trigger # 2.x - tests with after insert trigger
@ -316,4 +324,3 @@ do_test lastinsert-7.6 {
} {0 1205} } {0 1205}
finish_test finish_test

View File

@ -74,6 +74,15 @@ do_test laststmtchanges-1.5 {
} }
} {0 3} } {0 3}
# All remaining tests involve triggers. Skip them if triggers are not
# supported in this build.
#
ifcapable {!trigger} {
finish_test
return
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 2.x - tests with after insert trigger # 2.x - tests with after insert trigger
@ -254,4 +263,3 @@ do_test laststmtchanges-5.5 {
} {0 {0 1 0 3}} } {0 {0 1 0 3}}
finish_test finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is exercising the code in main.c. # focus of this file is exercising the code in main.c.
# #
# $Id: main.test,v 1.17 2004/11/03 16:27:02 drh Exp $ # $Id: main.test,v 1.18 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -75,120 +75,122 @@ do_test main-1.16 {
CREATE TABLE abc(x,y); CREATE TABLE abc(x,y);
} }
} {1} } {1}
do_test main-1.17 { ifcapable {trigger} {
db complete { do_test main-1.17 {
CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; db complete {
} CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr;
} {0} }
do_test main-1.18 { } {0}
db complete { do_test main-1.18 {
CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END; db complete {
} CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END;
} {1} }
do_test main-1.19 { } {1}
db complete { do_test main-1.19 {
CREATE TRIGGER xyz AFTER DELETE abc BEGIN db complete {
UPDATE pqr; CREATE TRIGGER xyz AFTER DELETE abc BEGIN
unknown command; UPDATE pqr;
} unknown command;
} {0} }
do_test main-1.20 { } {0}
db complete { do_test main-1.20 {
CREATE TRIGGER xyz AFTER DELETE backend BEGIN db complete {
UPDATE pqr; CREATE TRIGGER xyz AFTER DELETE backend BEGIN
} UPDATE pqr;
} {0} }
do_test main-1.21 { } {0}
db complete { do_test main-1.21 {
CREATE TRIGGER xyz AFTER DELETE end BEGIN db complete {
SELECT a, b FROM end; CREATE TRIGGER xyz AFTER DELETE end BEGIN
} SELECT a, b FROM end;
} {0} }
do_test main-1.22 { } {0}
db complete { do_test main-1.22 {
CREATE TRIGGER xyz AFTER DELETE end BEGIN db complete {
SELECT a, b FROM end; CREATE TRIGGER xyz AFTER DELETE end BEGIN
END; SELECT a, b FROM end;
} END;
} {1} }
do_test main-1.23 { } {1}
db complete { do_test main-1.23 {
CREATE TRIGGER xyz AFTER DELETE end BEGIN db complete {
SELECT a, b FROM end; CREATE TRIGGER xyz AFTER DELETE end BEGIN
END; SELECT a, b FROM end;
SELECT a, b FROM end; END;
} SELECT a, b FROM end;
} {1} }
do_test main-1.24 { } {1}
db complete { do_test main-1.24 {
CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN db complete {
UPDATE pqr; CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN
} UPDATE pqr;
} {0} }
do_test main-1.25 { } {0}
db complete { do_test main-1.25 {
CREATE TRIGGER xyz AFTER DELETE backend BEGIN db complete {
UPDATE pqr SET a=[;end;];;; CREATE TRIGGER xyz AFTER DELETE backend BEGIN
} UPDATE pqr SET a=[;end;];;;
} {0} }
do_test main-1.26 { } {0}
db complete { do_test main-1.26 {
CREATE -- a comment db complete {
TRIGGER xyz AFTER DELETE backend BEGIN CREATE -- a comment
UPDATE pqr SET a=5; TRIGGER xyz AFTER DELETE backend BEGIN
} UPDATE pqr SET a=5;
} {0} }
do_test main-1.27.1 { } {0}
db complete { do_test main-1.27.1 {
CREATE -- a comment db complete {
TRIGGERX xyz AFTER DELETE backend BEGIN CREATE -- a comment
UPDATE pqr SET a=5; TRIGGERX xyz AFTER DELETE backend BEGIN
} UPDATE pqr SET a=5;
} {1} }
do_test main-1.27.2 { } {1}
db complete { do_test main-1.27.2 {
CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
ifcapable {explain} {
do_test main-1.27.3 {
db complete { db complete {
/* */ EXPLAIN -- A comment
CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5; UPDATE pqr SET a=5;
} }
} {0} } {0}
} ifcapable {explain} {
do_test main-1.27.4 { do_test main-1.27.3 {
db complete { db complete {
BOGUS token /* */ EXPLAIN -- A comment
CREATE TRIGGER xyz AFTER DELETE backend BEGIN CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5; UPDATE pqr SET a=5;
}
} {0}
} }
} {1} do_test main-1.27.4 {
ifcapable {explain} { db complete {
do_test main-1.27.5 { BOGUS token
CREATE TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {1}
ifcapable {explain} {
do_test main-1.27.5 {
db complete {
EXPLAIN
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
}
do_test main-1.28 {
db complete { db complete {
EXPLAIN
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5; UPDATE pqr SET a=5;
} }
} {0} } {0}
do_test main-1.29 {
db complete {
CREATE TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
EXPLAIN select * from xyz;
}
} {0}
} }
do_test main-1.28 {
db complete {
CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
}
} {0}
do_test main-1.29 {
db complete {
CREATE TRIGGER xyz AFTER DELETE backend BEGIN
UPDATE pqr SET a=5;
EXPLAIN select * from xyz;
}
} {0}
do_test main-1.30 { do_test main-1.30 {
db complete { db complete {
CREATE TABLE /* In comment ; */ CREATE TABLE /* In comment ; */

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.30 2004/08/20 18:34:20 drh Exp $ # $Id: misc1.test,v 1.31 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -538,6 +538,7 @@ do_test misc1-16.6 {
} }
} {1 1 5 5 6 6} } {1 1 5 5 6 6}
ifcapable {trigger} {
# 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 {
@ -556,5 +557,6 @@ do_test misc1-17.1 {
SELECT TestString FROM RealTable ORDER BY 1; SELECT TestString FROM RealTable ORDER BY 1;
} }
} {2 3} } {2 3}
}
finish_test finish_test

View File

@ -13,11 +13,12 @@
# 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.12 2004/06/19 00:16:31 drh Exp $ # $Id: misc2.test,v 1.13 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
ifcapable {trigger} {
# Test for ticket #360 # Test for ticket #360
# #
do_test misc2-1.1 { do_test misc2-1.1 {
@ -35,6 +36,7 @@ do_test misc2-1.2 {
INSERT INTO foo(bar) VALUES (111); INSERT INTO foo(bar) VALUES (111);
} }
} {1 aiieee} } {1 aiieee}
} ;# endif trigger
# Make sure ROWID works on a view and a subquery. Ticket #364 # Make sure ROWID works on a view and a subquery. Ticket #364
# #

View File

@ -13,60 +13,65 @@
# 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: misc3.test,v 1.13 2004/11/03 16:27:02 drh Exp $ # $Id: misc3.test,v 1.14 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# Ticket #529. Make sure an ABORT does not damage the in-memory cache ifcapable {integrityck} {
# that will be used by subsequent statements in the same transaction. # Ticket #529. Make sure an ABORT does not damage the in-memory cache
# # that will be used by subsequent statements in the same transaction.
do_test misc3-1.1 { #
execsql { do_test misc3-1.1 {
CREATE TABLE t1(a UNIQUE,b); execsql {
INSERT INTO t1 CREATE TABLE t1(a UNIQUE,b);
INSERT INTO t1
VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
UPDATE t1 SET b=b||b;
INSERT INTO t1 VALUES(2,'x');
UPDATE t1 SET b=substr(b,1,500);
BEGIN;
}
catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';}
execsql {
CREATE TABLE t2(x,y);
COMMIT;
PRAGMA integrity_check;
}
} ok
}
ifcapable {integrityck} {
do_test misc3-1.2 {
execsql {
DROP TABLE t1;
DROP TABLE t2;
}
ifcapable {vacuum} {execsql VACUUM}
execsql {
CREATE TABLE t1(a UNIQUE,b);
INSERT INTO t1
VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_'); VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
UPDATE t1 SET b=b||b; INSERT INTO t1 SELECT a+1, b||b FROM t1;
UPDATE t1 SET b=b||b; INSERT INTO t1 SELECT a+2, b||b FROM t1;
UPDATE t1 SET b=b||b; INSERT INTO t1 SELECT a+4, b FROM t1;
UPDATE t1 SET b=b||b; INSERT INTO t1 SELECT a+8, b FROM t1;
UPDATE t1 SET b=b||b; INSERT INTO t1 SELECT a+16, b FROM t1;
INSERT INTO t1 VALUES(2,'x'); INSERT INTO t1 SELECT a+32, b FROM t1;
UPDATE t1 SET b=substr(b,1,500); INSERT INTO t1 SELECT a+64, b FROM t1;
BEGIN; BEGIN;
} }
catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';} catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
execsql { execsql {
CREATE TABLE t2(x,y); INSERT INTO t1 VALUES(200,'hello out there');
COMMIT; COMMIT;
PRAGMA integrity_check; PRAGMA integrity_check;
} }
} ok } ok
do_test misc3-1.2 { }
execsql {
DROP TABLE t1;
DROP TABLE t2;
VACUUM;
CREATE TABLE t1(a UNIQUE,b);
INSERT INTO t1
VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
INSERT INTO t1 SELECT a+1, b||b FROM t1;
INSERT INTO t1 SELECT a+2, b||b FROM t1;
INSERT INTO t1 SELECT a+4, b FROM t1;
INSERT INTO t1 SELECT a+8, b FROM t1;
INSERT INTO t1 SELECT a+16, b FROM t1;
INSERT INTO t1 SELECT a+32, b FROM t1;
INSERT INTO t1 SELECT a+64, b FROM t1;
BEGIN;
}
catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
execsql {
INSERT INTO t1 VALUES(200,'hello out there');
COMMIT;
PRAGMA integrity_check;
}
} ok
# Tests of the sqliteAtoF() function in util.c # Tests of the sqliteAtoF() function in util.c
# #
@ -253,6 +258,7 @@ ifcapable {explain} {
} {0 {}} } {0 {}}
} }
ifcapable {trigger} {
# Ticket #640: vdbe stack overflow with a LIMIT clause on a SELECT inside # Ticket #640: vdbe stack overflow with a LIMIT clause on a SELECT inside
# of a trigger. # of a trigger.
# #
@ -287,6 +293,7 @@ do_test misc3-7.3 {
SELECT count(*) FROM y3; SELECT count(*) FROM y3;
} }
} 32 } 32
} ;# endif trigger
# Ticket #668: VDBE stack overflow occurs when the left-hand side # Ticket #668: VDBE stack overflow occurs when the left-hand side
# of an IN expression is NULL and the result is used as an integer, not # of an IN expression is NULL and the result is used as an integer, not

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. # This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA. # This file implements tests for the page_size PRAGMA.
# #
# $Id: pagesize.test,v 1.6 2004/11/03 16:27:02 drh Exp $ # $Id: pagesize.test,v 1.7 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -88,9 +88,11 @@ foreach PGSZ {512 2048 4096 8192} {
do_test pagesize-2.$PGSZ.3 { do_test pagesize-2.$PGSZ.3 {
file size test.db file size test.db
} [expr {$PGSZ*2}] } [expr {$PGSZ*2}]
do_test pagesize-2.$PGSZ.4 { ifcapable {vacuum} {
execsql {VACUUM} do_test pagesize-2.$PGSZ.4 {
} {} execsql {VACUUM}
} {}
}
integrity_check pagesize-2.$PGSZ.5 integrity_check pagesize-2.$PGSZ.5
do_test pagesize-2.$PGSZ.6 { do_test pagesize-2.$PGSZ.6 {
db close db close
@ -148,17 +150,13 @@ foreach PGSZ {512 2048 4096 8192} {
} 192 } 192
integrity_check pagesize-2.$PGSZ.14 integrity_check pagesize-2.$PGSZ.14
do_test pagesize-2.$PGSZ.15 { do_test pagesize-2.$PGSZ.15 {
execsql { execsql {DELETE FROM t1 WHERE rowid%5!=0}
DELETE FROM t1 WHERE rowid%5!=0; ifcapable {vacuum} {execsql VACUUM}
VACUUM; execsql {SELECT count(*) FROM t1}
SELECT count(*) FROM t1;
}
} 38 } 38
do_test pagesize-2.$PGSZ.16 { do_test pagesize-2.$PGSZ.16 {
execsql { execsql {DROP TABLE t1}
DROP TABLE t1; ifcapable {vacuum} {execsql VACUUM}
VACUUM;
}
} {} } {}
integrity_check pagesize-2.$PGSZ.17 integrity_check pagesize-2.$PGSZ.17
} }

View File

@ -12,7 +12,7 @@
# focus of this file is testing the magic ROWID column that is # focus of this file is testing the magic ROWID column that is
# found on all tables. # found on all tables.
# #
# $Id: rowid.test,v 1.16 2004/06/27 21:31:40 drh Exp $ # $Id: rowid.test,v 1.17 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -368,6 +368,7 @@ do_test rowid-7.8 {
} }
} {2 66 3 111} } {2 66 3 111}
ifcapable {trigger} {
# Make sure AFTER triggers that do INSERTs do not change the last_insert_rowid. # Make sure AFTER triggers that do INSERTs do not change the last_insert_rowid.
# Ticket #290 # Ticket #290
# #
@ -419,6 +420,17 @@ do_test rowid-8.8 {
SELECT rowid, * FROM t4; SELECT rowid, * FROM t4;
} }
} {1 1 2 133 3 134} } {1 1 2 133 3 134}
} ;# endif trigger
# If triggers are not enable, simulate their effect for the tests that
# follow.
ifcapable {!trigger} {
execsql {
CREATE TABLE t3(a integer primary key);
INSERT INTO t3 VALUES(123);
INSERT INTO t3 VALUES(124);
}
}
# ticket #377: Comparison between integer primiary key and floating point # ticket #377: Comparison between integer primiary key and floating point
# values. # values.

View File

@ -11,11 +11,19 @@
# 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.27 2004/11/03 13:59:06 drh Exp $ # $Id: vacuum.test,v 1.28 2004/11/04 04:42:28 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# If the VACUUM statement is disabled in the current build, skip all
# the tests in this file.
#
ifcapable {!vacuum} {
finish_test
return
}
set fcnt 1 set fcnt 1
proc cksum {{db db}} { proc cksum {{db db}} {
set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type" set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type"