1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/trigger8.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,52 @@
1.4 +# 2006 February 27
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file implements regression tests for SQLite library.
1.15 +#
1.16 +# This file implements tests to make sure abusively large triggers
1.17 +# (triggers with 100s or 1000s of statements) work.
1.18 +#
1.19 +# $Id: $
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +ifcapable {!trigger} {
1.24 + finish_test
1.25 + return
1.26 +}
1.27 +
1.28 +# Set variable $nStatement to the number of statements to include in the
1.29 +# body of the trigger. On a workstation with virtually unlimited memory,
1.30 +# use 10000. But on symbian, which allows each application at most a 32MB
1.31 +# heap, use 1000.
1.32 +#
1.33 +set nStatement 10000
1.34 +if {$tcl_platform(platform) == "symbian"} {
1.35 + set nStatement 1000
1.36 +}
1.37 +
1.38 +do_test trigger8-1.1 {
1.39 + execsql {
1.40 + CREATE TABLE t1(x);
1.41 + CREATE TABLE t2(y);
1.42 + }
1.43 + set sql "CREATE TRIGGER r${nStatement} AFTER INSERT ON t1 BEGIN\n"
1.44 + for {set i 0} {$i<$nStatement} {incr i} {
1.45 + append sql " INSERT INTO t2 VALUES($i);\n"
1.46 + }
1.47 + append sql "END;"
1.48 + execsql $sql
1.49 + execsql {
1.50 + INSERT INTO t1 VALUES(5);
1.51 + SELECT count(*) FROM t2;
1.52 + }
1.53 +} $nStatement
1.54 +
1.55 +finish_test