diff options
Diffstat (limited to 'odb/sqlite/database.ixx')
-rw-r--r-- | odb/sqlite/database.ixx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/odb/sqlite/database.ixx b/odb/sqlite/database.ixx index a62dad1..e906a39 100644 --- a/odb/sqlite/database.ixx +++ b/odb/sqlite/database.ixx @@ -1,5 +1,4 @@ // file : odb/sqlite/database.ixx -// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file #include <utility> // move() @@ -15,6 +14,7 @@ namespace odb database (database&& db) // Has to be inline. : odb::database (std::move (db)), name_ (std::move (db.name_)), + schema_ (std::move (db.schema_)), flags_ (db.flags_), foreign_keys_ (db.foreign_keys_), vfs_ (std::move (db.vfs_)), @@ -24,6 +24,21 @@ namespace odb } #endif + inline void database:: + detach () + { + if (!schema_.empty ()) + static_cast<attached_connection_factory&> (*factory_).detach (); + } + + inline database& database:: + main_database () + { + return schema_.empty () + ? *this + : static_cast<attached_connection_factory&> (*factory_).main_connection_->database (); + } + inline connection_ptr database:: connection () { @@ -591,7 +606,7 @@ namespace odb { // Throws if not in transaction. // - sqlite::connection& c (transaction::current ().connection ()); + sqlite::connection& c (transaction::current ().connection (*this)); return c.prepare_query<T> (n, q); } |