diff options
-rw-r--r-- | odb/sqlite/connection.cxx | 23 | ||||
-rw-r--r-- | odb/sqlite/connection.hxx | 5 |
2 files changed, 26 insertions, 2 deletions
diff --git a/odb/sqlite/connection.cxx b/odb/sqlite/connection.cxx index 1e9ff6f..68b57f9 100644 --- a/odb/sqlite/connection.cxx +++ b/odb/sqlite/connection.cxx @@ -66,16 +66,35 @@ namespace odb translate_error (e, *this); } + init (); + } + + connection:: + connection (database_type& db, sqlite3* handle) + : odb::connection (db), + db_ (db), + handle_ (handle), + unlock_cond_ (unlock_mutex_), + statements_ (0) + { + init (); + } + + void connection:: + init () + { // Enable/disable foreign key constraints. // simple_statement st ( *this, - db.foreign_keys () + db_.foreign_keys () ? "PRAGMA foreign_keys=ON" : "PRAGMA foreign_keys=OFF", - db.foreign_keys () ? 22 : 23); + db_.foreign_keys () ? 22 : 23); st.execute (); + // Create statement cache. + // statement_cache_.reset (new statement_cache_type (*this)); } diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index e069ce9..e487e6b 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -43,6 +43,7 @@ namespace odb ~connection (); connection (database_type&, int extra_flags = 0); + connection (database_type&, sqlite3* handle); database_type& database () @@ -96,6 +97,10 @@ namespace odb connection& operator= (const connection&); private: + void + init (); + + private: database_type& db_; sqlite3* handle_; |