- enable
- True to enable foreign key constraints, false to disable them.
Type Reason Java.Lang.IllegalStateException if the are transactions is in progress when this method is called.
Sets whether foreign key constraints are enabled for the database.
By default, foreign key constraints are not enforced by the database. This method allows an application to enable foreign key constraints. It must be called each time the database is opened to ensure that foreign key constraints are enabled for the session.
A good time to call this method is right after calling SQLiteDatabase.OpenOrCreateDatabase(Java.IO.File, .ICursorFactory) or in the SQLiteOpenHelper.OnConfigure(SQLiteDatabase) callback.
When foreign key constraints are disabled, the database does not check whether changes to the database will violate foreign key constraints. Likewise, when foreign key constraints are disabled, the database will not execute cascade delete or update triggers. As a result, it is possible for the database state to become inconsistent. To perform a database integrity check, call SQLiteDatabase.IsDatabaseIntegrityOk.
This method must not be called while a transaction is in progress.
See also for more details about foreign key constraint support.