From 64f60cfa94d730ea5d6a9e7bc22a8d706f73d53c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Apr 2021 09:05:42 +0200 Subject: Add support for SQLite ATTACH DATABASE functionality --- odb/sqlite/connection.ixx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'odb/sqlite/connection.ixx') diff --git a/odb/sqlite/connection.ixx b/odb/sqlite/connection.ixx index 69739b7..c0e49b9 100644 --- a/odb/sqlite/connection.ixx +++ b/odb/sqlite/connection.ixx @@ -37,6 +37,36 @@ namespace odb return static_cast (factory_).database (); } + inline connection& connection:: + main_connection () + { + return handle_ != 0 + ? *this + : *static_cast (factory_).main_connection_; + } + + inline connection_ptr connection:: + main_connection (const connection_ptr& c) + { + return c->handle_ != 0 + ? c + : static_cast (c->factory_).main_connection_; + } + + inline sqlite3* connection:: + handle () + { + return handle_ != 0 + ? handle_ + : static_cast (factory_).main_connection_->handle_; + } + + inline connection_factory& connection:: + factory () + { + return static_cast (factory_); + } + template inline prepared_query connection:: prepare_query (const char* n, const char* q) -- cgit v1.1