sl@0: # 2006 February 27 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. sl@0: # sl@0: # This file implements tests to make sure abusively large triggers sl@0: # (triggers with 100s or 1000s of statements) work. sl@0: # sl@0: # $Id: $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: ifcapable {!trigger} { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: # Set variable $nStatement to the number of statements to include in the sl@0: # body of the trigger. On a workstation with virtually unlimited memory, sl@0: # use 10000. But on symbian, which allows each application at most a 32MB sl@0: # heap, use 1000. sl@0: # sl@0: set nStatement 10000 sl@0: if {$tcl_platform(platform) == "symbian"} { sl@0: set nStatement 1000 sl@0: } sl@0: sl@0: do_test trigger8-1.1 { sl@0: execsql { sl@0: CREATE TABLE t1(x); sl@0: CREATE TABLE t2(y); sl@0: } sl@0: set sql "CREATE TRIGGER r${nStatement} AFTER INSERT ON t1 BEGIN\n" sl@0: for {set i 0} {$i<$nStatement} {incr i} { sl@0: append sql " INSERT INTO t2 VALUES($i);\n" sl@0: } sl@0: append sql "END;" sl@0: execsql $sql sl@0: execsql { sl@0: INSERT INTO t1 VALUES(5); sl@0: SELECT count(*) FROM t2; sl@0: } sl@0: } $nStatement sl@0: sl@0: finish_test