trigger8.test 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. # $Id: trigger8.test,v 1.2 2008/09/17 16:14:10 danielk1977 Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. ifcapable {!trigger} {
  20. finish_test
  21. return
  22. }
  23. # Set variable $nStatement to the number of statements to include in the
  24. # body of the trigger. On a workstation with virtually unlimited memory,
  25. # use 10000. But on symbian, which allows each application at most a 32MB
  26. # heap, use 1000.
  27. #
  28. set nStatement 10000
  29. if {$tcl_platform(platform) == "symbian"} {
  30. set nStatement 1000
  31. }
  32. set nStatement 5
  33. do_test trigger8-1.1 {
  34. execsql {
  35. CREATE TABLE t1(x);
  36. CREATE TABLE t2(y);
  37. }
  38. set sql "CREATE TRIGGER r${nStatement} AFTER INSERT ON t1 BEGIN\n"
  39. for {set i 0} {$i<$nStatement} {incr i} {
  40. append sql " INSERT INTO t2 VALUES($i);\n"
  41. }
  42. append sql "END;"
  43. execsql $sql
  44. execsql {
  45. INSERT INTO t1 VALUES(5);
  46. SELECT count(*) FROM t2;
  47. }
  48. } $nStatement
  49. finish_test