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

Side by Side Diff: third_party/sqlite/src/test/fkey8.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 unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/fkey6.test ('k') | third_party/sqlite/src/test/fordelete.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2001 September 15 1 # 2001 September 15
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 #***********************************************************************
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 drop_all_tables 94 drop_all_tables
95 do_test 1.$tn { 95 do_test 1.$tn {
96 execsql $schema 96 execsql $schema
97 set stmt [sqlite3_prepare_v2 db $sql -1 dummy] 97 set stmt [sqlite3_prepare_v2 db $sql -1 dummy]
98 set ret [uses_stmt_journal $stmt] 98 set ret [uses_stmt_journal $stmt]
99 sqlite3_finalize $stmt 99 sqlite3_finalize $stmt
100 set ret 100 set ret
101 } $use_stmt 101 } $use_stmt
102 } 102 }
103 103
104 #-------------------------------------------------------------------------
105 # The following tests check that foreign key constaint counters are
106 # correctly updated for any implicit DELETE operations that occur
107 # when a REPLACE command is executed against a WITHOUT ROWID table
108 # that has no triggers or auxiliary indexes.
109 #
110 reset_db
111 do_execsql_test 2.1.0 {
112 PRAGMA foreign_keys = on;
113 CREATE TABLE p1(a PRIMARY KEY, b) WITHOUT ROWID;
114 CREATE TABLE c1(x REFERENCES p1 DEFERRABLE INITIALLY DEFERRED);
115
116 INSERT INTO p1 VALUES(1, 'one');
117 INSERT INTO p1 VALUES(2, 'two');
118 INSERT INTO c1 VALUES(1);
119 INSERT INTO c1 VALUES(2);
120 }
121
122 do_catchsql_test 2.1.2 {
123 BEGIN;
124 DELETE FROM p1 WHERE a=1;
125 INSERT OR REPLACE INTO p1 VALUES(2, 'two');
126 COMMIT;
127 } {1 {FOREIGN KEY constraint failed}}
128
129 reset_db
130 do_execsql_test 2.2.0 {
131 PRAGMA foreign_keys = on;
132 CREATE TABLE p2(a PRIMARY KEY, b);
133 CREATE TABLE c2(
134 x PRIMARY KEY,
135 y REFERENCES p2 DEFERRABLE INITIALLY DEFERRED
136 ) WITHOUT ROWID;
137 }
138
139 do_catchsql_test 2.2.1 {
140 BEGIN;
141 INSERT INTO c2 VALUES(13, 13);
142 INSERT OR REPLACE INTO c2 VALUES(13, 13);
143 DELETE FROM c2;
144 COMMIT;
145 } {0 {}}
146
147 reset_db
148 do_execsql_test 2.3.0 {
149 PRAGMA foreign_keys = on;
150 CREATE TABLE p3(a PRIMARY KEY, b) WITHOUT ROWID;
151 CREATE TABLE c3(x REFERENCES p3);
152
153 INSERT INTO p3 VALUES(1, 'one');
154 INSERT INTO p3 VALUES(2, 'two');
155 INSERT INTO c3 VALUES(1);
156 INSERT INTO c3 VALUES(2);
157
158 CREATE TRIGGER p3d AFTER DELETE ON p3 WHEN old.a=1 BEGIN
159 INSERT OR REPLACE INTO p3 VALUES(2, 'three');
160 END;
161 }
162
163 do_catchsql_test 2.3.1 {
164 DELETE FROM p3 WHERE a=1
165 } {1 {FOREIGN KEY constraint failed}}
104 166
105 finish_test 167 finish_test
106
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/fkey6.test ('k') | third_party/sqlite/src/test/fordelete.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698