Welcome Guest, Not a member yet? Register   Sign In
use CASCADING DELETE with SQLITE
#2

https://www.sqlite.org/pragma.html#pragma_foreign_keys

Quote:As of SQLite version 3.6.19, the default setting for foreign key enforcement is OFF. [...]  To minimize future problems, applications should set the foreign key enforcement flag as required by the application and not depend on the default setting.

So, when connecting to the database, you need to execute PRAGMA foreign_keys = on; The easiest way to do this would probably be to use the simple_query() method of the database library:

PHP Code:
$this->db->simple_query('PRAGMA foreign_keys = on'); 

You should only need to do this once per connection.
Reply


Messages In This Thread
use CASCADING DELETE with SQLITE - by gender - 07-31-2016, 04:40 AM
RE: use CASCADING DELETE with SQLITE - by mwhitney - 08-04-2016, 07:39 AM
RE: use CASCADING DELETE with SQLITE - by gender - 08-04-2016, 07:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB