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

Unified Diff: third_party/sqlite/src/tool/genfkey.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/whereA.test ('k') | third_party/sqlite/src/tool/lemon.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/tool/genfkey.test
diff --git a/third_party/sqlite/src/tool/genfkey.test b/third_party/sqlite/src/tool/genfkey.test
index e1011d62f1f3f525775c9dab840e8f6367441e83..3c0073e953dc0a2e60b421181b631c3bcaa37b96 100644
--- a/third_party/sqlite/src/tool/genfkey.test
+++ b/third_party/sqlite/src/tool/genfkey.test
@@ -292,3 +292,63 @@ do_test genfkey-5.5 {
}
} {0 {}}
+# Test also column names that require quoting.
+do_test genfkey-6.1 {
+ execsql {
+ DROP TABLE "t.3";
+ DROP TABLE t13;
+ CREATE TABLE p(
+ "a.1 first", "b.2 second",
+ UNIQUE("a.1 first", "b.2 second")
+ );
+ CREATE TABLE c(
+ "c.1 I", "d.2 II",
+ FOREIGN KEY("c.1 I", "d.2 II")
+ REFERENCES p("a.1 first", "b.2 second")
+ ON UPDATE CASCADE ON DELETE CASCADE
+ );
+ }
+} {}
+do_test genfkey-6.2 {
+ set rc [catch {exec ./sqlite3 test.db .genfkey} msg]
+} {0}
+do_test genfkey-6.3 {
+ execsql $msg
+ execsql {
+ INSERT INTO p VALUES('A', 'B');
+ INSERT INTO p VALUES('C', 'D');
+ INSERT INTO c VALUES('A', 'B');
+ INSERT INTO c VALUES('C', 'D');
+ UPDATE p SET "a.1 first" = 'X' WHERE rowid = 1;
+ DELETE FROM p WHERE rowid = 2;
+ }
+ execsql { SELECT * FROM c }
+} {X B}
+
+do_test genfkey-6.4 {
+ execsql {
+ DROP TABLE p;
+ DROP TABLE c;
+ CREATE TABLE parent("a.1", PRIMARY KEY("a.1"));
+ CREATE TABLE child("b.2", FOREIGN KEY("b.2") REFERENCES parent("a.1"));
+ }
+ set rc [catch {exec ./sqlite3 test.db .genfkey} msg]
+} {0}
+do_test genfkey-6.5 {
+ execsql $msg
+ execsql {
+ INSERT INTO parent VALUES(1);
+ INSERT INTO child VALUES(1);
+ }
+ catchsql { UPDATE parent SET "a.1"=0 }
+} {1 {constraint failed}}
+do_test genfkey-6.6 {
+ catchsql { UPDATE child SET "b.2"=7 }
+} {1 {constraint failed}}
+do_test genfkey-6.7 {
+ execsql {
+ SELECT * FROM parent;
+ SELECT * FROM child;
+ }
+} {1 1}
+
« no previous file with comments | « third_party/sqlite/src/test/whereA.test ('k') | third_party/sqlite/src/tool/lemon.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698