Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an OOM related crash in fkey.c. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
635d6a775a3f192d4292738905f5e01b |
User & Date: | dan 2009-09-22 15:53:48.000 |
Context
2009-09-22
| ||
16:08 | Fix a problem with ON DELETE SET DEFAULT actions. (check-in: 9406995055 user: dan tags: trunk) | |
15:53 | Fix an OOM related crash in fkey.c. (check-in: 635d6a775a user: dan tags: trunk) | |
13:25 | Allow specific exclusion of localtime_s() usage on Windows. (check-in: 216bcda7d2 user: shane tags: trunk) | |
Changes
Changes to src/fkey.c.
︙ | |||
618 619 620 621 622 623 624 | 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | - - + + + - - - + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + - + | static Trigger *fkActionTrigger( Parse *pParse, Table *pTab, /* Table being updated or deleted from */ FKey *pFKey, /* Foreign key to get action for */ ExprList *pChanges /* Change-list for UPDATE, NULL for DELETE */ ){ sqlite3 *db = pParse->db; /* Database handle */ |
︙ | |||
709 710 711 712 713 714 715 | 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + | }else{ pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0); } pList = sqlite3ExprListAppend(pParse, pList, pNew); sqlite3ExprListSetName(pParse, pList, &tFromCol, 0); } } |
︙ |
Changes to test/fkey2.test.
︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | + + + | # fkey2-5.*: Check that if foreign-keys are enabled, it is not possible # to write to an FK column using the incremental blob API. # # fkey2-6.*: Test that FK processing is automatically disabled when # running VACUUM. # # fkey2-7.*: Test using an IPK as the key in the child (referencing) table. # # fkey2-8.*: Test that enabling/disabling foreign key support while a # transaction is active is not possible. # # fkey2-genfkey.*: Tests that were used with the shell tool .genfkey # command. Recycled to test the built-in implementation. # proc drop_all_tables {{db db}} { |
︙ | |||
410 411 412 413 414 415 416 417 418 419 420 421 422 423 | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | + | } } {} } #------------------------------------------------------------------------- # Test that it is possible to use an INTEGER PRIMARY KEY as the child key # of a foreign constraint. # drop_all_tables do_test fkey2-7.1 { execsql { CREATE TABLE t1(a PRIMARY KEY, b); CREATE TABLE t2(c INTEGER PRIMARY KEY REFERENCES t1, b); } } {} |
︙ | |||
442 443 444 445 446 447 448 449 450 451 452 453 454 455 | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | + + + + + + + + + + + + + + + + + + + + + + + + + + | } {1 {foreign key constraint failed}} do_test fkey2-7.7 { execsql { DELETE FROM t1 WHERE a = 1 } } {} do_test fkey2-7.8 { catchsql { UPDATE t1 SET a = 3 } } {1 {foreign key constraint failed}} #------------------------------------------------------------------------- # Test that it is not possible to enable/disable FK support while a # transaction is open. # drop_all_tables proc fkey2-8-test {tn zSql value} { do_test fkey-2.8.$tn.1 [list execsql $zSql] {} do_test fkey-2.8.$tn.2 { execsql "PRAGMA foreign_keys" } $value } fkey2-8-test 1 { PRAGMA foreign_keys = 0 } 0 fkey2-8-test 2 { PRAGMA foreign_keys = 1 } 1 fkey2-8-test 3 { BEGIN } 1 fkey2-8-test 4 { PRAGMA foreign_keys = 0 } 1 fkey2-8-test 5 { COMMIT } 1 fkey2-8-test 6 { PRAGMA foreign_keys = 0 } 0 fkey2-8-test 7 { BEGIN } 0 fkey2-8-test 8 { PRAGMA foreign_keys = 1 } 0 fkey2-8-test 9 { COMMIT } 0 fkey2-8-test 10 { PRAGMA foreign_keys = 1 } 1 fkey2-8-test 11 { PRAGMA foreign_keys = off } 0 fkey2-8-test 12 { PRAGMA foreign_keys = on } 1 fkey2-8-test 13 { PRAGMA foreign_keys = no } 0 fkey2-8-test 14 { PRAGMA foreign_keys = yes } 1 fkey2-8-test 15 { PRAGMA foreign_keys = false } 0 fkey2-8-test 16 { PRAGMA foreign_keys = true } 1 #------------------------------------------------------------------------- # The following block of tests, those prefixed with "fkey2-genfkey.", are # the same tests that were used to test the ".genfkey" command provided # by the shell tool. So these tests show that the built-in foreign key # implementation is more or less compatible with the triggers generated # by genfkey. |
︙ |
Added test/fkey_malloc.test.
|