1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-22 20:22:44 +03:00

Add asserts as evidence that all FK constraints are either immediate or

deferred.

FossilOrigin-Name: 634ef4fc9f4051245b38f558bb1c733031548c2f
This commit is contained in:
drh
2009-10-12 22:30:49 +00:00
parent 9a616f5607
commit 4c4298392e
5 changed files with 19 additions and 14 deletions

View File

@@ -2267,7 +2267,7 @@ void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){
Table *pTab;
FKey *pFKey;
if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
assert( isDeferred==0 || isDeferred==1 );
assert( isDeferred==0 || isDeferred==1 ); /* EV: R-30323-21917 */
pFKey->isDeferred = (u8)isDeferred;
#endif
}

View File

@@ -1178,7 +1178,11 @@ void sqlite3FkDelete(Table *pTab){
fkTriggerDelete(pTab->dbMem, pFKey->apTrigger[1]);
#endif
/* Delete the memory allocated for the FK structure. */
/* EV: R-30323-21917 Each foreign key constraint in SQLite is
** classified as either immediate or deferred.
*/
assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 );
pNext = pFKey->pNextFrom;
sqlite3DbFree(pTab->dbMem, pFKey);
}

View File

@@ -1289,6 +1289,7 @@ struct FKey {
FKey *pNextTo; /* Next foreign key on table named zTo */
FKey *pPrevTo; /* Previous foreign key on table named zTo */
int nCol; /* Number of columns in this key */
/* EV: R-30323-21917 */
u8 isDeferred; /* True if constraint checking is deferred till COMMIT */
u8 aAction[2]; /* ON DELETE and ON UPDATE actions, respectively */
Trigger *apTrigger[2]; /* Triggers for aAction[] actions */