diff options
author | drh <drh@noemail.net> | 2013-07-11 12:19:12 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-07-11 12:19:12 +0000 |
commit | 963c74df5988fa4bf5dd6dda9fb15a9b09a0d6a4 (patch) | |
tree | d4caf2dfae4eb7cac77b5965a4410febaa68074f /src/pragma.c | |
parent | 888e16e7c50efe29c2e48ae7cf8cab942ba496fb (diff) | |
download | sqlite-963c74df5988fa4bf5dd6dda9fb15a9b09a0d6a4.tar.gz sqlite-963c74df5988fa4bf5dd6dda9fb15a9b09a0d6a4.zip |
Rename the SQLITE_DeferForeignKeys macro to shorter SQLITE_DeferFKs. Move
the "defer_foreign_keys" pragma into the flagPragma() routine.
FossilOrigin-Name: 3a2ab74c85a40e0e7ef2d6aef6ec23837cb788e6
Diffstat (limited to 'src/pragma.c')
-rw-r--r-- | src/pragma.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/pragma.c b/src/pragma.c index 9a288b977..fd0ebc727 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -197,12 +197,13 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted ** flag if there are any active statements. */ { "read_uncommitted", SQLITE_ReadUncommitted }, - { "recursive_triggers", SQLITE_RecTriggers }, + { "recursive_triggers", SQLITE_RecTriggers }, /* This flag may only be set if both foreign-key and trigger support ** are present in the build. */ #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - { "foreign_keys", SQLITE_ForeignKeys }, + { "foreign_keys", SQLITE_ForeignKeys }, + { "defer_foreign_keys", SQLITE_DeferFKs }, #endif }; int i; @@ -228,6 +229,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ db->flags |= mask; }else{ db->flags &= ~mask; + if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; } /* Many of the flag-pragmas modify the code generated by the SQL @@ -1169,21 +1171,6 @@ void sqlite3Pragma( } } }else - - if( sqlite3StrICmp(zLeft, "defer_foreign_keys")==0 ){ - if( zRight ){ - if( sqlite3GetBoolean(zRight, 0) ){ - db->flags |= SQLITE_DeferForeignKeys; - }else{ - db->flags &= ~SQLITE_DeferForeignKeys; - db->nDeferredImmCons = 0; - } - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); - }else{ - int bVal = !!(db->flags & SQLITE_DeferForeignKeys); - returnSingleInt(pParse, "defer_foreign_keys", bVal); - } - } #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ #ifndef SQLITE_OMIT_FOREIGN_KEY |