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

Unified Diff: third_party/sqlite/sqlite-src-3100200/test/fkey8.test

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: third_party/sqlite/sqlite-src-3100200/test/fkey8.test
diff --git a/third_party/sqlite/sqlite-src-3100200/test/fkey8.test b/third_party/sqlite/sqlite-src-3100200/test/fkey8.test
new file mode 100644
index 0000000000000000000000000000000000000000..60bb8e4640134208c378aa0d5b343fa1d46f1921
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3100200/test/fkey8.test
@@ -0,0 +1,106 @@
+# 2001 September 15
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# This file implements tests for foreign keys.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix fkey8
+
+ifcapable {!foreignkey} {
+ finish_test
+ return
+}
+do_execsql_test 1.0 { PRAGMA foreign_keys = 1; }
+
+
+foreach {tn use_stmt sql schema} {
+ 1 1 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1);
+ }
+
+ 2.1 0 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE);
+ }
+ 2.2 0 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE SET NULL);
+ }
+ 2.3 1 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE SET DEFAULT);
+ }
+
+ 3 1 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE);
+ CREATE TRIGGER ct1 AFTER DELETE ON c1 BEGIN
+ INSERT INTO p1 VALUES('x');
+ END;
+ }
+
+ 4 1 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY);
+ CREATE TABLE cc1(d REFERENCES c1);
+ }
+
+ 5.1 0 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY);
+ CREATE TABLE cc1(d REFERENCES c1 ON DELETE CASCADE);
+ }
+ 5.2 0 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY);
+ CREATE TABLE cc1(d REFERENCES c1 ON DELETE SET NULL);
+ }
+ 5.3 1 "DELETE FROM p1" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON DELETE CASCADE, c PRIMARY KEY);
+ CREATE TABLE cc1(d REFERENCES c1 ON DELETE SET DEFAULT);
+ }
+
+ 6.1 1 "UPDATE p1 SET a = ?" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON UPDATE SET NULL, c);
+ }
+ 6.2 0 "UPDATE OR IGNORE p1 SET a = ?" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON UPDATE SET NULL, c);
+ }
+ 6.3 1 "UPDATE OR IGNORE p1 SET a = ?" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b REFERENCES p1 ON UPDATE CASCADE, c);
+ }
+ 6.4 1 "UPDATE OR IGNORE p1 SET a = ?" {
+ CREATE TABLE p1(a PRIMARY KEY);
+ CREATE TABLE c1(b NOT NULL REFERENCES p1 ON UPDATE SET NULL, c);
+ }
+
+} {
+ drop_all_tables
+ do_test 1.$tn {
+ execsql $schema
+ set stmt [sqlite3_prepare_v2 db $sql -1 dummy]
+ set ret [uses_stmt_journal $stmt]
+ sqlite3_finalize $stmt
+ set ret
+ } $use_stmt
+}
+
+
+finish_test
+
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/test/fkey7.test ('k') | third_party/sqlite/sqlite-src-3100200/test/fkey_malloc.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698