]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
All tests pass even if OMIT_TRIGGER is defined. (CVS 2053)
authordrh <drh@noemail.net>
Thu, 4 Nov 2004 04:42:28 +0000 (04:42 +0000)
committerdrh <drh@noemail.net>
Thu, 4 Nov 2004 04:42:28 +0000 (04:42 +0000)
FossilOrigin-Name: c33b3a613751057e8a46fdcd428b8448329d414d

20 files changed:
manifest
manifest.uuid
src/delete.c
src/insert.c
src/update.c
test/attach.test
test/attach3.test
test/collate6.test
test/delete.test
test/index.test
test/interrupt.test
test/lastinsert.test
test/laststmtchanges.test
test/main.test
test/misc1.test
test/misc2.test
test/misc3.test
test/pagesize.test
test/rowid.test
test/vacuum.test

index cb640f5ad3bb98fa5967e26337132e80002a5ad8..d4f99325ab1df9bca06a02dcc3cbc9decf8baf0d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\s#ifdef\sin\sutil.c.\s\sTicket\s#984.\s(CVS\s2052)
-D 2004-11-04T04:34:15
+C All\stests\spass\seven\sif\sOMIT_TRIGGER\sis\sdefined.\s(CVS\s2053)
+D 2004-11-04T04:42:28
 F Makefile.in c4d2416860f472a1e3393714d0372074197565df
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@@ -33,12 +33,12 @@ F src/btree.c 93163198e6fb666b92c893fba5edb3ef6f335c0f
 F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
 F src/build.c bb896c5f85ab749d17ae5d730235134c12c08033
 F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad
-F src/delete.c cf0efbef1f42d4eec385a3f59af2b37a5e232074
+F src/delete.c 52980e594e69e80374fb928fe611d5f75ca4e390
 F src/expr.c 3a43e508a3dc213703808bbcbb17633b88b57d17
 F src/func.c 600e506bccf7648df8ad03efb417560d0f7ad4c1
 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
-F src/insert.c 64a3716522cbc81d91176eac0d944cc14be6236c
+F src/insert.c 17f66e2c32e551122f45cea11db3e664471418d6
 F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
 F src/main.c ba1b26f03af4b7f8be3394748123dd671b9ea147
 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
@@ -71,7 +71,7 @@ F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
 F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
 F src/tokenize.c bf9de9689b3bb813d65784bf54472804bf9595e6
 F src/trigger.c f9a0a8d3a87238de1a934eeb7d0b6b1f13e6a55b
-F src/update.c ee15b7ba712c2292802eba2d465f039b5deada39
+F src/update.c 7b17b281d600bf3e220b3c5718e0883442dee722
 F src/utf.c f4f83acd73389090e32d6589d307fc55d794c7ed
 F src/util.c 005fdf2d008f3429d081766ad6098fdd86d8d8e6
 F src/vacuum.c ecb4a2c6f1ac5cc9b394dc64d3bb14ca650c4f60
@@ -83,9 +83,9 @@ F src/vdbeaux.c 544ff66308d3184b519decc731abb65c5233bc2d
 F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56
 F src/where.c 6e637a6b3e61fe3104adc4e5caa4738bf6570daa
 F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
-F test/attach.test 6ad560eb3e77751a4faecd77da09deac9e38cc41
+F test/attach.test ff7fc16b4518a448fed47dfb3694bf57f522d552
 F test/attach2.test f7795123d3051ace1672b6d23973da6435de3745
-F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e
+F test/attach3.test 742c932d7130e0e699a5d9f265cb831e0a824633
 F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21
 F test/autovacuum.test 9211914801ad35ad8f0fc15711b12461850ef2ac
 F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f
@@ -106,13 +106,13 @@ F test/collate2.test 12fd658d8f5106a8a5c8a77d66919d8c89394036
 F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50
 F test/collate4.test c29c8d4b66cf45b36fa112c28493cdb451a8409b
 F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
-F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675
+F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638
 F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
 F test/corrupt.test 0080ddcece23e8ba47c44608c4fb73fd4d1d8ce2
 F test/crash.test a3f6d27f7cb7f7bd752461db1e14f7c781ecedc3
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/date.test dda578ec1857837156bd8b32f8e09d81d7d7881c
-F test/delete.test ec0b455f2dcc0e189d96ee438438ba026c4e51d8
+F test/delete.test fc29491f6a7ac899ce29f4549a104809e245d9a6
 F test/delete2.test 050a3a6e8ea0f83aed817d164b16af2a499fb452
 F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0
 F test/enc.test 2f5463af488d50aef60c6110bec6b21b5efba961
@@ -123,30 +123,30 @@ F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
 F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
 F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
 F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
-F test/index.test 83f5c232948801da2d9b7c603362d8e0313485bc
+F test/index.test 4098cd020180bec286ef1a96bca256e76cc7b654
 F test/insert.test c571223b499961d843ce0ab4709c87fa60ab2425
 F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
-F test/interrupt.test 6b6b8b86cdeb66d5488bd1db74b4bb3c46e4f565
+F test/interrupt.test 5c336baaf810e5f7a91d2f01e2cafca480885dfe
 F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
 F test/ioerr.test 3ce897ee998ee874073f3b23b0396d9ff804759c
 F test/join.test 9ef6aabaac9de51d5fc41e68d1f4355da05a84cd
 F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
 F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
-F test/lastinsert.test 31382f88b9b0270333ac9e4a17f2c2f4732da718
-F test/laststmtchanges.test 417aa27eb2b5cdfafb46e390e2c9ddd0a20eba43
+F test/lastinsert.test 09ac3a359ced3d4510feccc0dcbae3d80e449cf9
+F test/laststmtchanges.test 9cb56c5935103cacd0070d9d25d8dde322928db1
 F test/limit.test f7c06fccd76755e8d083b61c06bc31cf461b9c35
 F test/lock.test 7cb9395919a0986ee4dd08bd49d34df93c8fc4fe
 F test/lock2.test 2213590d442147d09fd2334c905a755586c1c398
 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
-F test/main.test add6cd4fc1264becd3d195431073f202738af317
+F test/main.test 5f9deae11b93336da1ccc5f91cf8be075c91ddf1
 F test/malloc.test 769b240d89a7ef3320d88919fdb6765f9395a51f
 F test/memdb.test b8a13fa79f006bd087bbcf135ce8eb62056a6027
 F test/memleak.test f1fa233f8295dd1d955a00d5e5ee857850f27f29
 F test/minmax.test c0f92d3f7b11656221735385f2c8b1878bbbdaf6
-F test/misc1.test 1a20ea722dff15155e93948dc4ac3e8d80fec386
-F test/misc2.test 703734f5817215ca54e364833b3bf5ff36fcc21e
-F test/misc3.test db48619711950a1098b9547a8091cbb440b22e54
+F test/misc1.test 744f60d1025fa978708b96cb222a07a1feb1524a
+F test/misc2.test 9d9403f7e6092699f3f92bb1e26ff55165528e7c
+F test/misc3.test 8c83c3810d6254d9d63b4cbf3941c7b9523c236d
 F test/misc4.test d005a75f095bb04db09a5d096144405ae566b622
 F test/misuse.test fcd9e7cec6ecccc34822584aec6b4e31f13629e1
 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
@@ -154,14 +154,14 @@ F test/null.test 642428b6a5408cc5b954b49e1b6e5025e4458b2b
 F test/pager.test 394455707a079804e8a4e431d12edce831a065f0
 F test/pager2.test c7e731ac56a2984a605b032ffd19b9deee820377
 F test/pager3.test 16f546293bb751b8151dc17df613fca938bbec8b
-F test/pagesize.test 86e14e54b608c00ecf86d14504ad8fed1e4e0064
+F test/pagesize.test 2050bb574c43f9143d283d6bcd37fa1eb73f0e49
 F test/pragma.test ed8156b5ef3a82ff7be6bd814b3715079ea5a6b0
 F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
 F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x
 F test/quick.test 2dca186ebd5c418a7699944ba3b5e437d765eddd
 F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62
 F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
-F test/rowid.test b3d059f5c8d8874fa1c31030e0636f67405d20ea
+F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
 F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f
 F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
 F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
@@ -191,7 +191,7 @@ F test/types2.test f23c147a2ab3e51d5dbcfa9987200db5acba7aa7
 F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b
 F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217
 F test/utf16.test 459c2f5ab80c60092c603630a348c32d6e59c558
-F test/vacuum.test 98831051cff8e6084f22785c79bdb10080c42dde
+F test/vacuum.test fea17dd67231ced71ef71ac15f01760593af5ff6
 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
 F test/view.test 2ec8fd4f3809243ad12667932071d536d1ba6850
 F test/where.test 8a016d444252553a0c7c3a4c806d3f782f7337eb
@@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
-P 571de52376f52999268ba5e0cd05c6c6eff1ebbf
-R 88bc900ed597200e93ade91a1a123d03
+P da045bd183335a112f9a6c805c12efe12d0a25ca
+R 3020d6f48bce04fcef7f5133e21d3db2
 U drh
-Z 7327d11a71a1235a378656ac4c026c33
+Z 625b1d515abab0cebf7c5f6337f4ff8c
index 47373639e21f78cb407e2ac00c2fa7d16cca691a..bfcf2e9e7ae66e7d89e5f934d2d49750db8328e3 100644 (file)
@@ -1 +1 @@
-da045bd183335a112f9a6c805c12efe12d0a25ca
\ No newline at end of file
+c33b3a613751057e8a46fdcd428b8448329d414d
\ No newline at end of file
index e9b2bf70703b21770c965b4bc326997277e5e164..a476c4fdeda9e7190e19f3f42c3e9dcc52438923 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -81,13 +81,15 @@ void sqlite3DeleteFrom(
   Index *pIdx;           /* For looping over indices of the table */
   int iCur;              /* VDBE Cursor number for pTab */
   sqlite3 *db;           /* Main database structure */
-  int isView;            /* True if attempting to delete from a view */
   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 before_triggers;         /* True if there are BEFORE 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;
   if( pParse->nErr || sqlite3_malloc_failed ){
@@ -271,7 +273,7 @@ void sqlite3DeleteFrom(
         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,
          addr);
     }
@@ -305,7 +307,7 @@ void sqlite3DeleteFrom(
         }
         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,
          addr);
     }
index d7a202a5dfafdfd9a5efbb9669d67be014fa8028..0112f8d524dc0761625014cffee665051c366db5 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -188,12 +188,14 @@ void sqlite3Insert(
   int iCleanup = 0;     /* Address of the cleanup code */
   int iInsertBlock = 0; /* Address of the subroutine used to insert data */
   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 before_triggers;        /* True if there are BEFORE 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;
   db = pParse->db;
index 1905c3073baace261221d869702786bf473b7095..b184c038cfa648a053cbd29acce031c77ca114cd 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -48,12 +48,14 @@ void sqlite3Update(
   int chngRecno;         /* True if the record number is being changed */
   Expr *pRecnoExpr = 0;  /* Expression defining the new record number */
   int openAll = 0;       /* True if all indices need to be opened */
-  int isView;            /* Trying to update a view */
   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 after_triggers;          /* True if there are any AFTER triggers */
   int row_triggers_exist = 0;  /* True if any row triggers exist */
+#endif
 
   int newIdx      = -1;  /* index of trigger "new" temp table       */
   int oldIdx      = -1;  /* index of trigger "old" temp table       */
index 26376d7bb5aa7cccac8f38bd54f224d311689556..f18dd6eac6c8e8d42ba8386d8295e168584acb7b 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this script is testing the ATTACH and DETACH commands
 # 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]
@@ -454,11 +454,11 @@ do_test attach-4.5 {
     SELECT * FROM db2.t3;
   }
 } {1 2 9 10}
+execsql {
+  DETACH db2;
+}
 ifcapable {trigger} {
   do_test attach-4.6 {
-    execsql {
-      DETACH db2;
-    }
     execsql {
       CREATE TABLE t4(x);
       CREATE TRIGGER t3r3 AFTER INSERT ON t3 BEGIN
@@ -479,6 +479,23 @@ ifcapable {trigger} {
     }
   } {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
 # 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}
 
 do_test attach-4.9 {
+  ifcapable {!trigger} {execsql {INSERT INTO main.t4 VALUES('main.15')}}
   execsql {
     INSERT INTO main.t3 VALUES(15,16);
     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
 #
+ifcapable {trigger} {
 do_test attach-5.1 {
   db close
   sqlite3 db test.db
@@ -609,6 +628,7 @@ do_test attach-5.9 {
     END;
   } db2
 } {1 {trigger r5 cannot reference objects in database temp}}
+} ;# endif trigger
 
 # Check to make sure we get a sensible error if unable to open
 # the file that we are trying to attach.
index 27b59c5ced42ca8ba88737910633a29ea86bb11d..cc310164afe8707f0507573337a975cca2273c1e 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this script is testing the ATTACH and DETACH commands
 # 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.
 do_test attach3-7.1 {
   execsql {
@@ -211,6 +212,7 @@ do_test attach3-9.2 {
     SELECT count(*) FROM sqlite_temp_master;
   }
 } {0}
+} ;# endif trigger
 
 # Make sure the aux.sqlite_master table is read-only
 do_test attach3-10.0 {
index c371e088be994f99fc6230e9f21afeb2d15a27ef..477ef4df48374ec63e99a273fb2e7b3190a68a44 100644 (file)
 # This file implements regression tests for SQLite library.  The
 # 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]
 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. 
 # Normally, capital letters are less than their lower-case counterparts.
 db collate NOCASE nocase_collate
@@ -101,6 +109,3 @@ do_test collate6-1.9 {
 
 
 finish_test
-
-
-
index 79ac457f58aca0a7dfce8430d5a03b40017856e1..d582bcf960f74c25e9acf4c1b2e77ba9074bb978 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # 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]
 source $testdir/tester.tcl
@@ -216,44 +216,49 @@ do_test delete-7.1 {
     SELECT * FROM t3;
   }
 } {1 2 3 4}
-do_test delete-7.2 {
-  execsql {
-    CREATE TABLE cnt(del);
-    INSERT INTO cnt VALUES(0);
-    CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN
-      UPDATE cnt SET del=del+1;
-    END;
-    DELETE FROM t3 WHERE a<2;
-    SELECT * FROM t3;
-  }
-} {2 3 4}
-do_test delete-7.3 {
-  execsql {
-    SELECT * FROM cnt;
-  }
-} {1}
-do_test delete-7.4 {
-  execsql {
-    DELETE FROM t3;
-    SELECT * FROM t3;
-  }
-} {}
-do_test delete-7.5 {
-  execsql {
-    SELECT * FROM cnt;
-  }
-} {4}
-do_test delete-7.6 {
-  execsql {
-    INSERT INTO t3 VALUES(1);
-    INSERT INTO t3 SELECT a+1 FROM t3;
-    INSERT INTO t3 SELECT a+2 FROM t3;
-    CREATE TABLE t4 AS SELECT * FROM t3;
-    PRAGMA count_changes=ON;
-    DELETE FROM t3;
-    DELETE FROM t4;
-  }
-} {4 4}
+ifcapable {trigger} {
+  do_test delete-7.2 {
+    execsql {
+      CREATE TABLE cnt(del);
+      INSERT INTO cnt VALUES(0);
+      CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN
+        UPDATE cnt SET del=del+1;
+      END;
+      DELETE FROM t3 WHERE a<2;
+      SELECT * FROM t3;
+    }
+  } {2 3 4}
+  do_test delete-7.3 {
+    execsql {
+      SELECT * FROM cnt;
+    }
+  } {1}
+  do_test delete-7.4 {
+    execsql {
+      DELETE FROM t3;
+      SELECT * FROM t3;
+    }
+  } {}
+  do_test delete-7.5 {
+    execsql {
+      SELECT * FROM cnt;
+    }
+  } {4}
+  do_test delete-7.6 {
+    execsql {
+      INSERT INTO t3 VALUES(1);
+      INSERT INTO t3 SELECT a+1 FROM t3;
+      INSERT INTO t3 SELECT a+2 FROM t3;
+      CREATE TABLE t4 AS SELECT * FROM t3;
+      PRAGMA count_changes=ON;
+      DELETE FROM t3;
+      DELETE FROM t4;
+    }
+  } {4 4}
+} ;# endif trigger
+ifcapable {!trigger} {
+  execsql {DELETE FROM t3}
+}
 integrity_check delete-7.7
 
 # Make sure error messages are consistent when attempting to delete
index 680affcbb091040a5b1929f2664893837f961a47..067c4daef03e1208efbfc7d3b7f13170522e00d0 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the CREATE INDEX statement.
 #
-# $Id: index.test,v 1.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]
 source $testdir/tester.tcl
@@ -598,11 +598,13 @@ do_test index-18.3 {
     CREATE VIEW sqlite_v1 AS SELECT * FROM t7;
   }
 } {1 {object name reserved for internal use: sqlite_v1}}
-do_test index-18.4 {
-  catchsql {
-    CREATE TRIGGER sqlite_tr1 BEFORE INSERT ON t7 BEGIN SELECT 1; END;
-  }
-} {1 {object name reserved for internal use: sqlite_tr1}}
+ifcapable {trigger} {
+  do_test index-18.4 {
+    catchsql {
+      CREATE TRIGGER sqlite_tr1 BEFORE INSERT ON t7 BEGIN SELECT 1; END;
+    }
+  } {1 {object name reserved for internal use: sqlite_tr1}}
+}
 do_test index-18.5 {
   execsql {
     DROP TABLE t7;
index 3860ea897de54bc14bc31b731d49e3705c233aa1..ed22d5ebbd3502f58e06332e50c371c937edc635 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # 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]
@@ -94,7 +94,9 @@ do_test interrrupt-2.1 {
 } 64
 set origsize [file size test.db]
 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 {
   execsql {
     SELECT md5sum(a || b) FROM t1;
index 702b437e8a8a5b3033dd909a69a6bf1ba2241bee..9b317222d2d46de9dab72a790a160d6c442c7b69 100644 (file)
@@ -61,6 +61,14 @@ do_test lastinsert-1.4 {
     }
 } {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
 
@@ -316,4 +324,3 @@ do_test lastinsert-7.6 {
 } {0 1205}
 
 finish_test
-
index f7adcd2e7998db880cb736e2ffb59d41fee97a0b..c2b16ea2a8a44384049bf24a015c5740588b7956 100644 (file)
@@ -74,6 +74,15 @@ do_test laststmtchanges-1.5 {
     }
 } {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
 
@@ -254,4 +263,3 @@ do_test laststmtchanges-5.5 {
 } {0 {0 1 0 3}}
 
 finish_test
-
index eab2764fe6eeb930e278ed82f21b2d60d79098b7..10ef35b2f2ad9ef49c02ffd1c8a3d6f46815a31a 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is exercising the code in main.c.
 #
-# $Id: main.test,v 1.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]
 source $testdir/tester.tcl
@@ -75,120 +75,122 @@ do_test main-1.16 {
     CREATE TABLE abc(x,y);
   }
 } {1}
-do_test main-1.17 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr;
-  }
-} {0}
-do_test main-1.18 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END;
-  }
-} {1}
-do_test main-1.19 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE abc BEGIN
-       UPDATE pqr;
-       unknown command;
-  }
-} {0}
-do_test main-1.20 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE backend BEGIN
-       UPDATE pqr;
-  }
-} {0}
-do_test main-1.21 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE end BEGIN
-       SELECT a, b FROM end;
-  }
-} {0}
-do_test main-1.22 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE end BEGIN
-       SELECT a, b FROM end;
-    END;
-  }
-} {1}
-do_test main-1.23 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE end BEGIN
-       SELECT a, b FROM end;
-    END;
-    SELECT a, b FROM end;
-  }
-} {1}
-do_test main-1.24 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN
-       UPDATE pqr;
-  }
-} {0}
-do_test main-1.25 {
-  db complete {
-    CREATE TRIGGER xyz AFTER DELETE backend BEGIN
-       UPDATE pqr SET a=[;end;];;;
-  }
-} {0}
-do_test main-1.26 {
-  db complete {
-    CREATE -- a comment
-    TRIGGER xyz AFTER DELETE backend BEGIN
-       UPDATE pqr SET a=5;
-  }
-} {0}
-do_test main-1.27.1 {
-  db complete {
-    CREATE -- a comment
-    TRIGGERX xyz AFTER DELETE backend BEGIN
-       UPDATE pqr SET a=5;
-  }
-} {1}
-do_test main-1.27.2 {
-  db complete {
-    CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
-       UPDATE pqr SET a=5;
-  }
-} {0}
-ifcapable {explain} {
-  do_test main-1.27.3 {
+ifcapable {trigger} {
+  do_test main-1.17 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr;
+    }
+  } {0}
+  do_test main-1.18 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE abc BEGIN UPDATE pqr; END;
+    }
+  } {1}
+  do_test main-1.19 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE abc BEGIN
+         UPDATE pqr;
+         unknown command;
+    }
+  } {0}
+  do_test main-1.20 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE backend BEGIN
+         UPDATE pqr;
+    }
+  } {0}
+  do_test main-1.21 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE end BEGIN
+         SELECT a, b FROM end;
+    }
+  } {0}
+  do_test main-1.22 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE end BEGIN
+         SELECT a, b FROM end;
+      END;
+    }
+  } {1}
+  do_test main-1.23 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE end BEGIN
+         SELECT a, b FROM end;
+      END;
+      SELECT a, b FROM end;
+    }
+  } {1}
+  do_test main-1.24 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE [;end;] BEGIN
+         UPDATE pqr;
+    }
+  } {0}
+  do_test main-1.25 {
+    db complete {
+      CREATE TRIGGER xyz AFTER DELETE backend BEGIN
+         UPDATE pqr SET a=[;end;];;;
+    }
+  } {0}
+  do_test main-1.26 {
+    db complete {
+      CREATE -- a comment
+      TRIGGER xyz AFTER DELETE backend BEGIN
+         UPDATE pqr SET a=5;
+    }
+  } {0}
+  do_test main-1.27.1 {
+    db complete {
+      CREATE -- a comment
+      TRIGGERX xyz AFTER DELETE backend BEGIN
+         UPDATE pqr SET a=5;
+    }
+  } {1}
+  do_test main-1.27.2 {
     db complete {
-      /* */ EXPLAIN -- A comment
       CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
          UPDATE pqr SET a=5;
     }
   } {0}
-}
-do_test main-1.27.4 {
-  db complete {
-    BOGUS token
-    CREATE  TRIGGER xyz AFTER DELETE backend BEGIN
-       UPDATE pqr SET a=5;
+  ifcapable {explain} {
+    do_test main-1.27.3 {
+      db complete {
+        /* */ EXPLAIN -- A comment
+        CREATE/**/TRIGGER xyz AFTER DELETE backend BEGIN
+           UPDATE pqr SET a=5;
+      }
+    } {0}
   }
-} {1}
-ifcapable {explain} {
-  do_test main-1.27.5 {
+  do_test main-1.27.4 {
+    db complete {
+      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 {
-      EXPLAIN 
       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.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 {
   db complete {
      CREATE TABLE /* In comment ; */
index 8a9137e2971041c1b85bef37986cd4b7056df848..a6f1bf44da97431f7b8f60a7b28d2bf5d9a1005d 100644 (file)
@@ -13,7 +13,7 @@
 # This file implements tests for miscellanous features that were
 # left out of other test files.
 #
-# $Id: misc1.test,v 1.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]
 source $testdir/tester.tcl
@@ -538,6 +538,7 @@ do_test misc1-16.6 {
   }
 } {1 1 5 5 6 6}
 
+ifcapable {trigger} {
 # Ticket #333: Temp triggers that modify persistent tables.
 #
 do_test misc1-17.1 {
@@ -556,5 +557,6 @@ do_test misc1-17.1 {
     SELECT TestString FROM RealTable ORDER BY 1;
   }
 } {2 3}
+}
 
 finish_test
index 1eefe95f889f17e3f1e264b20a030b30eb2b493d..9a2c9dba512a813bc1092c93e767af42f7e80770 100644 (file)
 # This file implements tests for miscellanous features that were
 # 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]
 source $testdir/tester.tcl
 
+ifcapable {trigger} {
 # Test for ticket #360
 #
 do_test misc2-1.1 {
@@ -35,6 +36,7 @@ do_test misc2-1.2 {
     INSERT INTO foo(bar) VALUES (111);
   }
 } {1 aiieee}
+} ;# endif trigger
 
 # Make sure ROWID works on a view and a subquery.  Ticket #364
 #
index a15f008fa7075c2d71c9aafa4fdc9ec458edde8b..77ad6f7796e8e78c55755edc5751f2485af186c2 100644 (file)
 # This file implements tests for miscellanous features that were
 # 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]
 source $testdir/tester.tcl
 
-# 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 {
-    CREATE TABLE t1(a UNIQUE,b);
-    INSERT INTO t1
+ifcapable {integrityck} {
+  # 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 {
+      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_');
-    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
-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
+      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
 #
@@ -253,6 +258,7 @@ ifcapable {explain} {
   } {0 {}}
 }
 
+ifcapable {trigger} {
 # Ticket #640:  vdbe stack overflow with a LIMIT clause on a SELECT inside
 # of a trigger.
 #
@@ -287,6 +293,7 @@ do_test misc3-7.3 {
     SELECT count(*) FROM y3;
   }
 } 32
+} ;# endif trigger
 
 # 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
index ea253531b974f17d738d7b31f898104c5556ee2d..bb984387c30149b15c8f5c4cd7577ed78794a123 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.
 # This file implements tests for the page_size PRAGMA.
 #
-# $Id: pagesize.test,v 1.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]
@@ -88,9 +88,11 @@ foreach PGSZ {512 2048 4096 8192} {
   do_test pagesize-2.$PGSZ.3 {
     file size test.db
   } [expr {$PGSZ*2}]
-  do_test pagesize-2.$PGSZ.4 {
-    execsql {VACUUM}
-  } {}
+  ifcapable {vacuum} {
+    do_test pagesize-2.$PGSZ.4 {
+      execsql {VACUUM}
+    } {}
+  }
   integrity_check pagesize-2.$PGSZ.5
   do_test pagesize-2.$PGSZ.6 {
     db close
@@ -148,17 +150,13 @@ foreach PGSZ {512 2048 4096 8192} {
   } 192
   integrity_check pagesize-2.$PGSZ.14
   do_test pagesize-2.$PGSZ.15 {
-    execsql {
-      DELETE FROM t1 WHERE rowid%5!=0;
-      VACUUM;
-      SELECT count(*) FROM t1;
-    }
+    execsql {DELETE FROM t1 WHERE rowid%5!=0}
+    ifcapable {vacuum} {execsql VACUUM}
+    execsql {SELECT count(*) FROM t1}
   } 38
   do_test pagesize-2.$PGSZ.16 {
-    execsql {
-      DROP TABLE t1;
-      VACUUM;
-    }
+    execsql {DROP TABLE t1}
+    ifcapable {vacuum} {execsql VACUUM}
   } {}
   integrity_check pagesize-2.$PGSZ.17
 }
index 64dac527b3ba34f3cbb391f989904ec80d3859ee..5a0b361387b54aab6b19be6eb679ab2075b1525d 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing the magic ROWID column that is
 # 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]
 source $testdir/tester.tcl
@@ -368,6 +368,7 @@ do_test rowid-7.8 {
   }
 } {2 66 3 111}
 
+ifcapable {trigger} {
 # Make sure AFTER triggers that do INSERTs do not change the last_insert_rowid.
 # Ticket #290
 #
@@ -419,6 +420,17 @@ do_test rowid-8.8 {
     SELECT rowid, * FROM t4;
   }
 } {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
 # values.
index 3894d17b7d3a872a8b01e767fa673b47d9fe7887..f8dd56086cf75e68811c25ace07796bac0b360bd 100644 (file)
 # This file implements regression tests for SQLite library.  The
 # 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]
 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
 proc cksum {{db db}} {
   set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type"