tkt3731.test 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # 2009 March 18
  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. #
  12. # $Id: tkt3731.test,v 1.1 2009/03/17 22:33:01 drh Exp $
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. ifcapable {!trigger} {
  16. finish_test
  17. return
  18. }
  19. # The tests in this file were written before SQLite supported recursive
  20. # trigger invocation, and some tests depend on that to pass. So disable
  21. # recursive triggers for this file.
  22. catchsql { pragma recursive_triggers = off }
  23. do_test tkt3731-1.1 {
  24. execsql {
  25. CREATE TABLE t1(a PRIMARY KEY, b);
  26. CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
  27. INSERT INTO t1 VALUES(new.a || '+', new.b || '+');
  28. END;
  29. }
  30. } {}
  31. do_test tkt3731-1.2 {
  32. execsql {
  33. INSERT INTO t1 VALUES('a', 'b');
  34. INSERT INTO t1 VALUES('c', 'd');
  35. SELECT * FROM t1;
  36. }
  37. } {a b a+ b+ c d c+ d+}
  38. do_test tkt3731-1.3 {
  39. execsql {
  40. DELETE FROM t1;
  41. CREATE TABLE t2(a, b);
  42. INSERT INTO t2 VALUES('e', 'f');
  43. INSERT INTO t2 VALUES('g', 'h');
  44. INSERT INTO t1 SELECT * FROM t2;
  45. SELECT * FROM t1;
  46. }
  47. } {e f e+ f+ g h g+ h+}
  48. integrity_check tkt3731-1.4
  49. finish_test