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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 package require sqlite3 2 package require sqlite3
3 3
4 proc do_test {name cmd expected} { 4 proc do_test {name cmd expected} {
5 puts -nonewline "$name ..." 5 puts -nonewline "$name ..."
6 set res [uplevel $cmd] 6 set res [uplevel $cmd]
7 if {$res eq $expected} { 7 if {$res eq $expected} {
8 puts Ok 8 puts Ok
9 } else { 9 } else {
10 puts Error 10 puts Error
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 do_test genfkey-5.5 { 285 do_test genfkey-5.5 {
286 catchsql { INSERT INTO t13 VALUES(1) } 286 catchsql { INSERT INTO t13 VALUES(1) }
287 } {1 {constraint failed}} 287 } {1 {constraint failed}}
288 do_test genfkey-5.5 { 288 do_test genfkey-5.5 {
289 catchsql { 289 catchsql {
290 INSERT INTO "t.3" VALUES(1); 290 INSERT INTO "t.3" VALUES(1);
291 INSERT INTO t13 VALUES(1); 291 INSERT INTO t13 VALUES(1);
292 } 292 }
293 } {0 {}} 293 } {0 {}}
294 294
295 # Test also column names that require quoting.
296 do_test genfkey-6.1 {
297 execsql {
298 DROP TABLE "t.3";
299 DROP TABLE t13;
300 CREATE TABLE p(
301 "a.1 first", "b.2 second",
302 UNIQUE("a.1 first", "b.2 second")
303 );
304 CREATE TABLE c(
305 "c.1 I", "d.2 II",
306 FOREIGN KEY("c.1 I", "d.2 II")
307 REFERENCES p("a.1 first", "b.2 second")
308 ON UPDATE CASCADE ON DELETE CASCADE
309 );
310 }
311 } {}
312 do_test genfkey-6.2 {
313 set rc [catch {exec ./sqlite3 test.db .genfkey} msg]
314 } {0}
315 do_test genfkey-6.3 {
316 execsql $msg
317 execsql {
318 INSERT INTO p VALUES('A', 'B');
319 INSERT INTO p VALUES('C', 'D');
320 INSERT INTO c VALUES('A', 'B');
321 INSERT INTO c VALUES('C', 'D');
322 UPDATE p SET "a.1 first" = 'X' WHERE rowid = 1;
323 DELETE FROM p WHERE rowid = 2;
324 }
325 execsql { SELECT * FROM c }
326 } {X B}
327
328 do_test genfkey-6.4 {
329 execsql {
330 DROP TABLE p;
331 DROP TABLE c;
332 CREATE TABLE parent("a.1", PRIMARY KEY("a.1"));
333 CREATE TABLE child("b.2", FOREIGN KEY("b.2") REFERENCES parent("a.1"));
334 }
335 set rc [catch {exec ./sqlite3 test.db .genfkey} msg]
336 } {0}
337 do_test genfkey-6.5 {
338 execsql $msg
339 execsql {
340 INSERT INTO parent VALUES(1);
341 INSERT INTO child VALUES(1);
342 }
343 catchsql { UPDATE parent SET "a.1"=0 }
344 } {1 {constraint failed}}
345 do_test genfkey-6.6 {
346 catchsql { UPDATE child SET "b.2"=7 }
347 } {1 {constraint failed}}
348 do_test genfkey-6.7 {
349 execsql {
350 SELECT * FROM parent;
351 SELECT * FROM child;
352 }
353 } {1 1}
354
OLDNEW
« 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