Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: third_party/sqlite/src/test/triggerF.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/triggerE.test ('k') | third_party/sqlite/src/test/types2.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/triggerF.test
diff --git a/third_party/sqlite/src/test/triggerF.test b/third_party/sqlite/src/test/triggerF.test
new file mode 100644
index 0000000000000000000000000000000000000000..d5e3565eddccfcea310eae3f76522eab1b5cf96e
--- /dev/null
+++ b/third_party/sqlite/src/test/triggerF.test
@@ -0,0 +1,72 @@
+# 2017 January 4
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice', here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix triggerF
+ifcapable {!trigger} {
+ finish_test
+ return
+}
+
+
+foreach {tn sql log} {
+ 1 { } { }
+
+ 2 {
+ CREATE TRIGGER trd AFTER DELETE ON t1 BEGIN
+ INSERT INTO log VALUES(old.a || old.b || (SELECT count(*) FROM t1));
+ END;
+ } {1one2 2two1 3three1}
+
+ 3 {
+ CREATE TRIGGER trd BEFORE DELETE ON t1 BEGIN
+ INSERT INTO log VALUES(old.a || old.b || (SELECT count(*) FROM t1));
+ END;
+ } {1one3 2two2 3three2}
+
+ 4 {
+ CREATE TRIGGER tr1 AFTER DELETE ON t1 BEGIN
+ INSERT INTO log VALUES(old.a || old.b || (SELECT count(*) FROM t1));
+ END;
+ CREATE TRIGGER tr2 BEFORE DELETE ON t1 BEGIN
+ INSERT INTO log VALUES(old.a || old.b || (SELECT count(*) FROM t1));
+ END;
+ } {1one3 1one2 2two2 2two1 3three2 3three1}
+
+} {
+ reset_db
+ do_execsql_test 1.$tn.0 {
+ PRAGMA recursive_triggers = on;
+ CREATE TABLE t1(a INT PRIMARY KEY, b) WITHOUT ROWID;
+ CREATE TABLE log(t);
+ }
+
+ execsql $sql
+
+ do_execsql_test 1.$tn.1 {
+ INSERT INTO t1 VALUES(1, 'one');
+ INSERT INTO t1 VALUES(2, 'two');
+ INSERT INTO t1 VALUES(3, 'three');
+
+ DELETE FROM t1 WHERE a=1;
+ INSERT OR REPLACE INTO t1 VALUES(2, 'three');
+ UPDATE OR REPLACE t1 SET a=3 WHERE a=2;
+ }
+
+ do_execsql_test 1.$tn.2 {
+ SELECT * FROM log ORDER BY rowid;
+ } $log
+}
+
+finish_test
+
« no previous file with comments | « third_party/sqlite/src/test/triggerE.test ('k') | third_party/sqlite/src/test/types2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698