OLD | NEW |
1 # 2009 August 24 | 1 # 2009 August 24 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice', here is a blessing: | 4 # a legal notice', here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 | 12 |
13 set testdir [file dirname $argv0] | 13 set testdir [file dirname $argv0] |
14 source $testdir/tester.tcl | 14 source $testdir/tester.tcl |
| 15 set testprefix triggerC |
15 ifcapable {!trigger} { | 16 ifcapable {!trigger} { |
16 finish_test | 17 finish_test |
17 return | 18 return |
18 } | 19 } |
19 | 20 |
20 #------------------------------------------------------------------------- | 21 #------------------------------------------------------------------------- |
21 # Test organization: | 22 # Test organization: |
22 # | 23 # |
23 # triggerC-1.*: Haphazardly designed trigger related tests that were useful | 24 # triggerC-1.*: Haphazardly designed trigger related tests that were useful |
24 # during an upgrade of the triggers sub-system. | 25 # during an upgrade of the triggers sub-system. |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 INSERT INTO t4 VALUES(0); | 987 INSERT INTO t4 VALUES(0); |
987 SELECT * FROM t5; | 988 SELECT * FROM t5; |
988 } | 989 } |
989 | 990 |
990 reset_db | 991 reset_db |
991 do_execsql_test triggerC-14.1 $SQL {1 2 3} | 992 do_execsql_test triggerC-14.1 $SQL {1 2 3} |
992 reset_db | 993 reset_db |
993 optimization_control db factor-constants 0 | 994 optimization_control db factor-constants 0 |
994 do_execsql_test triggerC-14.2 $SQL {1 2 3} | 995 do_execsql_test triggerC-14.2 $SQL {1 2 3} |
995 | 996 |
| 997 #------------------------------------------------------------------------- |
| 998 # Check that table names used by trigger programs are dequoted exactly |
| 999 # once. |
| 1000 # |
| 1001 do_execsql_test 15.1.1 { |
| 1002 PRAGMA recursive_triggers = 1; |
| 1003 CREATE TABLE node( |
| 1004 id int not null primary key, |
| 1005 pid int not null default 0 references node, |
| 1006 key varchar not null, |
| 1007 path varchar default '', |
| 1008 unique(pid, key) |
| 1009 ); |
| 1010 CREATE TRIGGER node_delete_referencing AFTER DELETE ON "node" |
| 1011 BEGIN |
| 1012 DELETE FROM "node" WHERE pid = old."id"; |
| 1013 END; |
| 1014 } |
| 1015 do_execsql_test 15.1.2 { |
| 1016 INSERT INTO node(id, pid, key) VALUES(9, 0, 'test'); |
| 1017 INSERT INTO node(id, pid, key) VALUES(90, 9, 'test1'); |
| 1018 INSERT INTO node(id, pid, key) VALUES(900, 90, 'test2'); |
| 1019 DELETE FROM node WHERE id=9; |
| 1020 SELECT * FROM node; |
| 1021 } |
| 1022 |
| 1023 do_execsql_test 15.2.1 { |
| 1024 CREATE TABLE x1 (x); |
| 1025 |
| 1026 CREATE TABLE x2 (a, b); |
| 1027 CREATE TABLE '"x2"'(a, b); |
| 1028 |
| 1029 INSERT INTO x2 VALUES(1, 2); |
| 1030 INSERT INTO x2 VALUES(3, 4); |
| 1031 INSERT INTO '"x2"' SELECT * FROM x2; |
| 1032 |
| 1033 CREATE TRIGGER x1ai AFTER INSERT ON x1 BEGIN |
| 1034 INSERT INTO """x2""" VALUES('x', 'y'); |
| 1035 DELETE FROM """x2""" WHERE a=1; |
| 1036 UPDATE """x2""" SET b = 11 WHERE a = 3; |
| 1037 END; |
| 1038 |
| 1039 INSERT INTO x1 VALUES('go!'); |
| 1040 } |
| 1041 |
| 1042 do_execsql_test 15.2.2 { SELECT * FROM x2; } {1 2 3 4} |
| 1043 do_execsql_test 15.2.3 { SELECT * FROM """x2"""; } {3 11 x y} |
| 1044 |
996 finish_test | 1045 finish_test |
OLD | NEW |