1187e4c6aSdrh# 2006 February 27 2187e4c6aSdrh# 3187e4c6aSdrh# The author disclaims copyright to this source code. In place of 4187e4c6aSdrh# a legal notice, here is a blessing: 5187e4c6aSdrh# 6187e4c6aSdrh# May you do good and not evil. 7187e4c6aSdrh# May you find forgiveness for yourself and forgive others. 8187e4c6aSdrh# May you share freely, never taking more than you give. 9187e4c6aSdrh# 10187e4c6aSdrh#*********************************************************************** 11187e4c6aSdrh# This file implements regression tests for SQLite library. 12187e4c6aSdrh# 13187e4c6aSdrh# This file implements tests to make sure abusively large triggers 14187e4c6aSdrh# (triggers with 100s or 1000s of statements) work. 15187e4c6aSdrh# 1689bae3edSdanielk1977# $Id: trigger8.test,v 1.2 2008/09/17 16:14:10 danielk1977 Exp $ 17187e4c6aSdrh 18187e4c6aSdrhset testdir [file dirname $argv0] 19187e4c6aSdrhsource $testdir/tester.tcl 20187e4c6aSdrhifcapable {!trigger} { 21187e4c6aSdrh finish_test 22187e4c6aSdrh return 23187e4c6aSdrh} 24187e4c6aSdrh 2589bae3edSdanielk1977# Set variable $nStatement to the number of statements to include in the 2689bae3edSdanielk1977# body of the trigger. On a workstation with virtually unlimited memory, 2789bae3edSdanielk1977# use 10000. But on symbian, which allows each application at most a 32MB 2889bae3edSdanielk1977# heap, use 1000. 2989bae3edSdanielk1977# 3089bae3edSdanielk1977set nStatement 10000 3189bae3edSdanielk1977if {$tcl_platform(platform) == "symbian"} { 3289bae3edSdanielk1977 set nStatement 1000 3389bae3edSdanielk1977} 34187e4c6aSdrh 35*165921a7Sdanset nStatement 5 36187e4c6aSdrhdo_test trigger8-1.1 { 37187e4c6aSdrh execsql { 38187e4c6aSdrh CREATE TABLE t1(x); 39187e4c6aSdrh CREATE TABLE t2(y); 40187e4c6aSdrh } 4189bae3edSdanielk1977 set sql "CREATE TRIGGER r${nStatement} AFTER INSERT ON t1 BEGIN\n" 4289bae3edSdanielk1977 for {set i 0} {$i<$nStatement} {incr i} { 43187e4c6aSdrh append sql " INSERT INTO t2 VALUES($i);\n" 44187e4c6aSdrh } 45187e4c6aSdrh append sql "END;" 46187e4c6aSdrh execsql $sql 47187e4c6aSdrh execsql { 48187e4c6aSdrh INSERT INTO t1 VALUES(5); 49187e4c6aSdrh SELECT count(*) FROM t2; 50187e4c6aSdrh } 5189bae3edSdanielk1977} $nStatement 52187e4c6aSdrh 53187e4c6aSdrhfinish_test 54