xref: /sqlite-3.40.0/test/trigger8.test (revision 74e4352a)
1# 2006 February 27
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library.
12#
13# This file implements tests to make sure abusively large triggers
14# (triggers with 100s or 1000s of statements) work.
15#
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19ifcapable {!trigger} {
20  finish_test
21  return
22}
23
24
25do_test trigger8-1.1 {
26  execsql {
27    CREATE TABLE t1(x);
28    CREATE TABLE t2(y);
29  }
30  set sql "CREATE TRIGGER r10000 AFTER INSERT ON t1 BEGIN\n"
31  for {set i 0} {$i<10000} {incr i} {
32    append sql "  INSERT INTO t2 VALUES($i);\n"
33  }
34  append sql "END;"
35  execsql $sql
36  execsql {
37    INSERT INTO t1 VALUES(5);
38    SELECT count(*) FROM t2;
39  }
40} {10000}
41
42finish_test
43