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

Side by Side Diff: third_party/sqlite/src/test/trigger2.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
OLDNEW
1 # The author disclaims copyright to this source code. In place of 1 # The author disclaims copyright to this source code. In place of
2 # a legal notice, here is a blessing: 2 # a legal notice, here is a blessing:
3 # 3 #
4 # May you do good and not evil. 4 # May you do good and not evil.
5 # May you find forgiveness for yourself and forgive others. 5 # May you find forgiveness for yourself and forgive others.
6 # May you share freely, never taking more than you give. 6 # May you share freely, never taking more than you give.
7 # 7 #
8 #*********************************************************************** 8 #***********************************************************************
9 # 9 #
10 # Regression testing of FOR EACH ROW table triggers 10 # Regression testing of FOR EACH ROW table triggers
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 execsql { 490 execsql {
491 BEGIN; 491 BEGIN;
492 INSERT INTO tbl values (1, 2, 3); 492 INSERT INTO tbl values (1, 2, 3);
493 SELECT * from tbl; 493 SELECT * from tbl;
494 } 494 }
495 } {1 2 3} 495 } {1 2 3}
496 do_test trigger2-6.1b { 496 do_test trigger2-6.1b {
497 catchsql { 497 catchsql {
498 INSERT OR ABORT INTO tbl values (2, 2, 3); 498 INSERT OR ABORT INTO tbl values (2, 2, 3);
499 } 499 }
500 } {1 {column a is not unique}} 500 } {1 {UNIQUE constraint failed: tbl.a}}
501 do_test trigger2-6.1c { 501 do_test trigger2-6.1c {
502 execsql { 502 execsql {
503 SELECT * from tbl; 503 SELECT * from tbl;
504 } 504 }
505 } {1 2 3} 505 } {1 2 3}
506 do_test trigger2-6.1d { 506 do_test trigger2-6.1d {
507 catchsql { 507 catchsql {
508 INSERT OR FAIL INTO tbl values (2, 2, 3); 508 INSERT OR FAIL INTO tbl values (2, 2, 3);
509 } 509 }
510 } {1 {column a is not unique}} 510 } {1 {UNIQUE constraint failed: tbl.a}}
511 do_test trigger2-6.1e { 511 do_test trigger2-6.1e {
512 execsql { 512 execsql {
513 SELECT * from tbl; 513 SELECT * from tbl;
514 } 514 }
515 } {1 2 3 2 2 3} 515 } {1 2 3 2 2 3}
516 do_test trigger2-6.1f { 516 do_test trigger2-6.1f {
517 execsql { 517 execsql {
518 INSERT OR REPLACE INTO tbl values (2, 2, 3); 518 INSERT OR REPLACE INTO tbl values (2, 2, 3);
519 SELECT * from tbl; 519 SELECT * from tbl;
520 } 520 }
521 } {1 2 3 2 0 0} 521 } {1 2 3 2 0 0}
522 do_test trigger2-6.1g { 522 do_test trigger2-6.1g {
523 catchsql { 523 catchsql {
524 INSERT OR ROLLBACK INTO tbl values (3, 2, 3); 524 INSERT OR ROLLBACK INTO tbl values (3, 2, 3);
525 } 525 }
526 } {1 {column a is not unique}} 526 } {1 {UNIQUE constraint failed: tbl.a}}
527 do_test trigger2-6.1h { 527 do_test trigger2-6.1h {
528 execsql { 528 execsql {
529 SELECT * from tbl; 529 SELECT * from tbl;
530 } 530 }
531 } {} 531 } {}
532 execsql {DELETE FROM tbl} 532 execsql {DELETE FROM tbl}
533 533
534 534
535 # Handling of ON CONFLICT by UPDATE statements inside triggers 535 # Handling of ON CONFLICT by UPDATE statements inside triggers
536 execsql { 536 execsql {
537 INSERT INTO tbl values (4, 2, 3); 537 INSERT INTO tbl values (4, 2, 3);
538 INSERT INTO tbl values (6, 3, 4); 538 INSERT INTO tbl values (6, 3, 4);
539 CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN 539 CREATE TRIGGER au_tbl AFTER UPDATE ON tbl BEGIN
540 UPDATE OR IGNORE tbl SET a = new.a, c = 10; 540 UPDATE OR IGNORE tbl SET a = new.a, c = 10;
541 END; 541 END;
542 } 542 }
543 do_test trigger2-6.2a { 543 do_test trigger2-6.2a {
544 execsql { 544 execsql {
545 BEGIN; 545 BEGIN;
546 UPDATE tbl SET a = 1 WHERE a = 4; 546 UPDATE tbl SET a = 1 WHERE a = 4;
547 SELECT * from tbl; 547 SELECT * from tbl;
548 } 548 }
549 } {1 2 10 6 3 4} 549 } {1 2 10 6 3 4}
550 do_test trigger2-6.2b { 550 do_test trigger2-6.2b {
551 catchsql { 551 catchsql {
552 UPDATE OR ABORT tbl SET a = 4 WHERE a = 1; 552 UPDATE OR ABORT tbl SET a = 4 WHERE a = 1;
553 } 553 }
554 } {1 {column a is not unique}} 554 } {1 {UNIQUE constraint failed: tbl.a}}
555 do_test trigger2-6.2c { 555 do_test trigger2-6.2c {
556 execsql { 556 execsql {
557 SELECT * from tbl; 557 SELECT * from tbl;
558 } 558 }
559 } {1 2 10 6 3 4} 559 } {1 2 10 6 3 4}
560 do_test trigger2-6.2d { 560 do_test trigger2-6.2d {
561 catchsql { 561 catchsql {
562 UPDATE OR FAIL tbl SET a = 4 WHERE a = 1; 562 UPDATE OR FAIL tbl SET a = 4 WHERE a = 1;
563 } 563 }
564 } {1 {column a is not unique}} 564 } {1 {UNIQUE constraint failed: tbl.a}}
565 do_test trigger2-6.2e { 565 do_test trigger2-6.2e {
566 execsql { 566 execsql {
567 SELECT * from tbl; 567 SELECT * from tbl;
568 } 568 }
569 } {4 2 10 6 3 4} 569 } {4 2 10 6 3 4}
570 do_test trigger2-6.2f.1 { 570 do_test trigger2-6.2f.1 {
571 execsql { 571 execsql {
572 UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4; 572 UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
573 SELECT * from tbl; 573 SELECT * from tbl;
574 } 574 }
575 } {1 3 10} 575 } {1 3 10}
576 do_test trigger2-6.2f.2 { 576 do_test trigger2-6.2f.2 {
577 execsql { 577 execsql {
578 INSERT INTO tbl VALUES (2, 3, 4); 578 INSERT INTO tbl VALUES (2, 3, 4);
579 SELECT * FROM tbl; 579 SELECT * FROM tbl;
580 } 580 }
581 } {1 3 10 2 3 4} 581 } {1 3 10 2 3 4}
582 do_test trigger2-6.2g { 582 do_test trigger2-6.2g {
583 catchsql { 583 catchsql {
584 UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1; 584 UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;
585 } 585 }
586 } {1 {column a is not unique}} 586 } {1 {UNIQUE constraint failed: tbl.a}}
587 do_test trigger2-6.2h { 587 do_test trigger2-6.2h {
588 execsql { 588 execsql {
589 SELECT * from tbl; 589 SELECT * from tbl;
590 } 590 }
591 } {4 2 3 6 3 4} 591 } {4 2 3 6 3 4}
592 execsql { 592 execsql {
593 DROP TABLE tbl; 593 DROP TABLE tbl;
594 } 594 }
595 } ; # ifcapable conflict 595 } ; # ifcapable conflict
596 596
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 END; 750 END;
751 DELETE FROM v3 WHERE a = 1; 751 DELETE FROM v3 WHERE a = 1;
752 } 752 }
753 } {} 753 } {}
754 754
755 } ;# ifcapable view 755 } ;# ifcapable view
756 756
757 integrity_check trigger2-9.9 757 integrity_check trigger2-9.9
758 758
759 finish_test 759 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698