diff options
Diffstat (limited to 'odb/sqlite/connection.cxx')
-rw-r--r-- | odb/sqlite/connection.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/odb/sqlite/connection.cxx b/odb/sqlite/connection.cxx index d90c301..ffb70a7 100644 --- a/odb/sqlite/connection.cxx +++ b/odb/sqlite/connection.cxx @@ -66,6 +66,16 @@ namespace odb translate_error (e, *this); } + // Enable/disable foreign key constraints. + // + simple_statement st ( + *this, + db.foreign_keys () + ? "PRAGMA foreign_keys=ON" + : "PRAGMA foreign_keys=OFF", + db.foreign_keys () ? 22 : 23); + st.execute (); + statement_cache_.reset (new statement_cache_type (*this)); } |