/ Check-in [9d6c6129]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adjust some test cases in triggerC.test to handle non-default SQLITE_MAX_TRIGGER_DEPTH settings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d6c6129fd8be42c164f14bb90011b252c1f2c46
User & Date: shaneh 2011-04-17 00:55:13
Context
2011-04-17
17:09
Change the prototype for the open() system call to agree with Posix. Though a faulty function prototype in a pointer cast is a seemingly innocuous error, the correct prototype is necessary for pthreads to work correctly on NetBSD. check-in: 3e135748 user: drh tags: trunk
00:55
Adjust some test cases in triggerC.test to handle non-default SQLITE_MAX_TRIGGER_DEPTH settings. check-in: 9d6c6129 user: shaneh tags: trunk
2011-04-15
21:37
Adjust test case in quota.test to handle Windows dir seperators. check-in: 75ed1bce user: shaneh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/triggerC.test.

   242    242   
   243    243       INSERT INTO t22 VALUES(1);
   244    244       SELECT count(*) FROM t22;
   245    245     }
   246    246   } {100}
   247    247   
   248    248   do_test triggerC-2.3 {
   249         -  execsql {
          249  +  execsql "
   250    250       CREATE TABLE t23(x PRIMARY KEY);
   251    251   
   252    252       CREATE TRIGGER t23a AFTER INSERT ON t23 BEGIN
   253    253         INSERT INTO t23 VALUES(new.x + 1);
   254    254       END;
   255    255   
   256    256       CREATE TRIGGER t23b BEFORE INSERT ON t23 BEGIN
   257         -      SELECT CASE WHEN new.x>500
          257  +      SELECT CASE WHEN new.x>[expr $SQLITE_MAX_TRIGGER_DEPTH / 2]
   258    258                     THEN RAISE(IGNORE)
   259    259                     ELSE NULL END;
   260    260       END;
   261    261   
   262    262       INSERT INTO t23 VALUES(1);
   263    263       SELECT count(*) FROM t23;
   264         -  }
   265         -} {500}
          264  +  "
          265  +} [list [expr $SQLITE_MAX_TRIGGER_DEPTH / 2]]
   266    266    
   267    267   
   268    268   #-----------------------------------------------------------------------
   269    269   # This block of tests, triggerC-3.*, test that SQLite throws an exception
   270    270   # when it detects excessive recursion.
   271    271   #
   272    272   do_test triggerC-3.1.1 {
................................................................................
   284    284     catchsql { INSERT INTO t3 VALUES(0,0) }
   285    285   } {1 {too many levels of trigger recursion}}
   286    286   do_test triggerC-3.1.3 {
   287    287     execsql { SELECT * FROM t3 }
   288    288   } {}
   289    289   
   290    290   do_test triggerC-3.2.1 {
   291         -  execsql {
          291  +  execsql "
   292    292       CREATE TABLE t3b(x);
   293         -    CREATE TRIGGER t3bi AFTER INSERT ON t3b WHEN new.x<2000 BEGIN
          293  +    CREATE TRIGGER t3bi AFTER INSERT ON t3b WHEN new.x<[expr $SQLITE_MAX_TRIGGER_DEPTH * 2] BEGIN
   294    294         INSERT INTO t3b VALUES(new.x+1);
   295    295       END;
   296         -  }
          296  +  "
   297    297     catchsql {
   298    298       INSERT INTO t3b VALUES(1);
   299    299     }
   300    300   } {1 {too many levels of trigger recursion}}
   301    301   do_test triggerC-3.2.2 {
   302    302     db eval {SELECT * FROM t3b}
   303    303   } {}
   304    304   
   305    305   do_test triggerC-3.3.1 {
   306         -  catchsql {
   307         -    INSERT INTO t3b VALUES(1001);
   308         -  }
          306  +  catchsql "
          307  +    INSERT INTO t3b VALUES([expr $SQLITE_MAX_TRIGGER_DEPTH + 1]);
          308  +  "
   309    309   } {0 {}}
   310    310   do_test triggerC-3.3.2 {
   311    311     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   312         -} {1000 2000 1001}
          312  +} [list $SQLITE_MAX_TRIGGER_DEPTH [expr $SQLITE_MAX_TRIGGER_DEPTH * 2] [expr $SQLITE_MAX_TRIGGER_DEPTH + 1]]
   313    313   
   314    314   do_test triggerC-3.4.1 {
   315         -  catchsql {
          315  +  catchsql "
   316    316       DELETE FROM t3b;
   317         -    INSERT INTO t3b VALUES(999);
   318         -  }
          317  +    INSERT INTO t3b VALUES([expr $SQLITE_MAX_TRIGGER_DEPTH - 1]);
          318  +  "
   319    319   } {1 {too many levels of trigger recursion}}
   320    320   do_test triggerC-3.4.2 {
   321    321     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   322    322   } {0 {} {}}
   323    323   
   324    324   do_test triggerC-3.5.1 {
   325         -  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 100
   326         -  catchsql {
   327         -    INSERT INTO t3b VALUES(1901);
   328         -  }
          325  +  sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH  [expr $SQLITE_MAX_TRIGGER_DEPTH / 10]
          326  +  catchsql "
          327  +    INSERT INTO t3b VALUES([expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - ($SQLITE_MAX_TRIGGER_DEPTH / 10) + 1]);
          328  +  "
   329    329   } {0 {}}
   330    330   do_test triggerC-3.5.2 {
   331    331     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   332         -} {100 2000 1901}
          332  +} [list [expr $SQLITE_MAX_TRIGGER_DEPTH / 10] [expr $SQLITE_MAX_TRIGGER_DEPTH * 2] [expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - ($SQLITE_MAX_TRIGGER_DEPTH / 10) + 1]]
   333    333   
   334    334   do_test triggerC-3.5.3 {
   335         -  catchsql {
          335  +  catchsql "
   336    336       DELETE FROM t3b;
   337         -    INSERT INTO t3b VALUES(1900);
   338         -  }
          337  +    INSERT INTO t3b VALUES([expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - ($SQLITE_MAX_TRIGGER_DEPTH / 10)]);
          338  +  "
   339    339   } {1 {too many levels of trigger recursion}}
   340    340   do_test triggerC-3.5.4 {
   341    341     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   342    342   } {0 {} {}}
   343    343   
   344    344   do_test triggerC-3.6.1 {
   345    345     sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1
   346         -  catchsql {
   347         -    INSERT INTO t3b VALUES(2000);
   348         -  }
          346  +  catchsql "
          347  +    INSERT INTO t3b VALUES([expr $SQLITE_MAX_TRIGGER_DEPTH * 2]);
          348  +  "
   349    349   } {0 {}}
   350    350   do_test triggerC-3.6.2 {
   351    351     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   352         -} {1 2000 2000}
          352  +} [list 1 [expr $SQLITE_MAX_TRIGGER_DEPTH * 2] [expr $SQLITE_MAX_TRIGGER_DEPTH * 2]]
   353    353   
   354    354   do_test triggerC-3.6.3 {
   355         -  catchsql {
          355  +  catchsql "
   356    356       DELETE FROM t3b;
   357         -    INSERT INTO t3b VALUES(1999);
   358         -  }
          357  +    INSERT INTO t3b VALUES([expr ($SQLITE_MAX_TRIGGER_DEPTH * 2) - 1]);
          358  +  "
   359    359   } {1 {too many levels of trigger recursion}}
   360    360   do_test triggerC-3.6.4 {
   361    361     db eval {SELECT count(*), max(x), min(x) FROM t3b}
   362    362   } {0 {} {}}
   363         -sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH 1000
   364         -      
          363  +sqlite3_limit db SQLITE_LIMIT_TRIGGER_DEPTH $SQLITE_MAX_TRIGGER_DEPTH
          364  +
   365    365   
   366    366   #-----------------------------------------------------------------------
   367    367   # This next block of tests, triggerC-4.*, checks that affinity 
   368    368   # transformations and constraint processing is performed at the correct 
   369    369   # times relative to BEFORE and AFTER triggers.
   370    370   #
   371    371   # For an INSERT statement, for each row to be inserted: