diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-04-29 09:05:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-04-30 12:25:45 +0200 |
commit | 64f60cfa94d730ea5d6a9e7bc22a8d706f73d53c (patch) | |
tree | 1de8d43fa0da0ca9005c459461a8c303e74322ba /odb/sqlite/database.ixx | |
parent | fa3f14db14671b4c37c400880d097b17aa12b824 (diff) |
Add support for SQLite ATTACH DATABASE functionality
Diffstat (limited to 'odb/sqlite/database.ixx')
-rw-r--r-- | odb/sqlite/database.ixx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/sqlite/database.ixx b/odb/sqlite/database.ixx index d5302a1..e906a39 100644 --- a/odb/sqlite/database.ixx +++ b/odb/sqlite/database.ixx @@ -14,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_)), @@ -23,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 () { |