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

Side by Side Diff: third_party/sqlite/src/test/fkey1.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/filefmt.test ('k') | third_party/sqlite/src/test/fkey2.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 #***********************************************************************
11 # This file implements regression tests for SQLite library. 11 # This file implements regression tests for SQLite library.
12 # 12 #
13 # This file implements tests for foreign keys. 13 # This file implements tests for foreign keys.
14 # 14 #
15 15
16 set testdir [file dirname $argv0] 16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl 17 source $testdir/tester.tcl
18 set testprefix fkey1
18 19
19 ifcapable {!foreignkey} { 20 ifcapable {!foreignkey} {
20 finish_test 21 finish_test
21 return 22 return
22 } 23 }
23 24
24 # Create a table and some data to work with. 25 # Create a table and some data to work with.
25 # 26 #
26 do_test fkey1-1.0 { 27 do_test fkey1-1.0 {
27 execsql { 28 execsql {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 ); 179 );
179 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (1, null, 'A'); 180 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (1, null, 'A');
180 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 1, 'A-2-1'); 181 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 1, 'A-2-1');
181 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (3, 2, 'A-3-2'); 182 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (3, 2, 'A-3-2');
182 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (4, 3, 'A-4-3'); 183 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (4, 3, 'A-4-3');
183 } 184 }
184 do_catchsql_test fkey1-5.4 { 185 do_catchsql_test fkey1-5.4 {
185 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 3, 'A-2-3'); 186 INSERT OR REPLACE INTO Foo(Id, ParentId, C1) VALUES (2, 3, 'A-2-3');
186 } {1 {FOREIGN KEY constraint failed}} 187 } {1 {FOREIGN KEY constraint failed}}
187 188
189 #-------------------------------------------------------------------------
190 # Check that foreign key processing is not fooled by partial indexes
191 # on the parent table.
192 #
193 do_execsql_test 6.0 {
194 CREATE TABLE p1(x, y);
195 CREATE UNIQUE INDEX p1x ON p1(x) WHERE y<2;
196 INSERT INTO p1 VALUES(1, 1);
197 CREATE TABLE c1(a REFERENCES p1(x));
198 }
199
200 do_catchsql_test 6.1 {
201 INSERT INTO c1 VALUES(1);
202 } {1 {foreign key mismatch - "c1" referencing "p1"}}
203
204 do_execsql_test 6.2 {
205 CREATE UNIQUE INDEX p1x2 ON p1(x);
206 INSERT INTO c1 VALUES(1);
207 } {}
208
209
188 finish_test 210 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/filefmt.test ('k') | third_party/sqlite/src/test/fkey2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698