From 5a69eecefb4f5d29d7ab76f81e69ab27d85586cf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Aug 2011 10:47:30 +0200 Subject: Enable foreign key constraints checking in SQLite Due to bugs in SQLite DDL foreign key support, we have to temporarily disable foreign keys when re-creating the schema. New manual section: 12.5.3, "Foreign Key Constraints". --- odb/sqlite/database.hxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'odb/sqlite/database.hxx') diff --git a/odb/sqlite/database.hxx b/odb/sqlite/database.hxx index 0eadbbf..13c44e6 100644 --- a/odb/sqlite/database.hxx +++ b/odb/sqlite/database.hxx @@ -35,6 +35,7 @@ namespace odb public: database (const std::string& name, int flags = SQLITE_OPEN_READWRITE, + bool foreign_keys = true, std::auto_ptr = std::auto_ptr (0)); @@ -56,6 +57,7 @@ namespace odb char* argv[], bool erase = false, int flags = SQLITE_OPEN_READWRITE, + bool foreign_keys = true, std::auto_ptr = std::auto_ptr (0)); @@ -76,6 +78,12 @@ namespace odb return flags_; } + bool + foreign_keys () const + { + return foreign_keys_; + } + // Transactions. // public: @@ -103,6 +111,7 @@ namespace odb private: std::string name_; int flags_; + bool foreign_keys_; std::auto_ptr factory_; }; } -- cgit v1.1