Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove an unused variable from fkey.c. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
582bd7682831362cd0e2f91ac0dba5ab |
User & Date: | dan 2009-09-29 11:28:52.000 |
Context
2009-09-29
| ||
15:41 | Check that a unique index uses the default collation sequences for each column before using it as part of a foreign key constraint operation. (check-in: 64154174cf user: dan tags: trunk) | |
11:28 | Remove an unused variable from fkey.c. (check-in: 582bd76828 user: dan tags: trunk) | |
06:33 | Various fixes so that "make test" works with OMIT_FOREIGN_KEY, OMIT_TRIGGER and OMIT_ALTER_TABLE. (check-in: e4eb227b14 user: dan tags: trunk) | |
Changes
Changes to src/fkey.c.
︙ | ︙ | |||
679 680 681 682 683 684 685 | sqlite3 *db = pParse->db; /* Database handle */ Vdbe *v; /* VM to write code to */ FKey *pFKey; /* Used to iterate through FKs */ int iDb; /* Index of database containing pTab */ const char *zDb; /* Name of database containing pTab */ int isIgnoreErrors = pParse->disableTriggers; | > | < < < | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | sqlite3 *db = pParse->db; /* Database handle */ Vdbe *v; /* VM to write code to */ FKey *pFKey; /* Used to iterate through FKs */ int iDb; /* Index of database containing pTab */ const char *zDb; /* Name of database containing pTab */ int isIgnoreErrors = pParse->disableTriggers; /* Exactly one of regOld and regNew should be non-zero. */ assert( (regOld==0)!=(regNew==0) ); /* If foreign-keys are disabled, this function is a no-op. */ if( (db->flags&SQLITE_ForeignKeys)==0 ) return; v = sqlite3GetVdbe(pParse); iDb = sqlite3SchemaToIndex(db, pTab->pSchema); zDb = db->aDb[iDb].zName; |
︙ | ︙ | |||
756 757 758 759 760 761 762 | } sqlite3DbFree(db, aiFree); } /* Loop through all the foreign key constraints that refer to this table */ for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ | < | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | } sqlite3DbFree(db, aiFree); } /* Loop through all the foreign key constraints that refer to this table */ for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ Index *pIdx = 0; /* Foreign key index for pFKey */ SrcList *pSrc; int *aiCol = 0; if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){ assert( regOld==0 && regNew!=0 ); /* Inserting a single row into a parent table cannot cause an immediate |
︙ | ︙ | |||
804 805 806 807 808 809 810 | ** immediately if the FK constraint is violated, even if this is a ** deferred trigger. That's what RESTRICT means. To defer checking ** the constraint, the FK should specify NO ACTION (represented ** using OE_None). NO ACTION is the default. */ fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); } | < < < | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | ** immediately if the FK constraint is violated, even if this is a ** deferred trigger. That's what RESTRICT means. To defer checking ** the constraint, the FK should specify NO ACTION (represented ** using OE_None). NO ACTION is the default. */ fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); } sqlite3SrcListDelete(db, pSrc); } sqlite3DbFree(db, aiCol); } } #define COLUMN_MASK(x) (((x)>31) ? 0xffffffff : ((u32)1<<(x))) |
︙ | ︙ |
Changes to test/fkey2.test.
︙ | ︙ | |||
608 609 610 611 612 613 614 | catchsql { DELETE FROM t1 } } {1 {foreign key constraint failed}} #------------------------------------------------------------------------- # The following tests, fkey2-10.*, test "foreign key mismatch" and # other errors. # | < > > > > > > | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | catchsql { DELETE FROM t1 } } {1 {foreign key constraint failed}} #------------------------------------------------------------------------- # The following tests, fkey2-10.*, test "foreign key mismatch" and # other errors. # set tn 1 foreach zSql [list { CREATE TABLE p(a PRIMARY KEY, b); CREATE TABLE c(x REFERENCES p(c)); } { CREATE TABLE c(x REFERENCES v(y)); CREATE VIEW v AS SELECT x AS y FROM c; } { CREATE TABLE p(a, b, PRIMARY KEY(a, b)); CREATE TABLE c(x REFERENCES p); }] { drop_all_tables do_test fkey2-10.1.$tn { execsql $zSql catchsql { INSERT INTO c DEFAULT VALUES } } {1 {foreign key mismatch}} |
︙ | ︙ |