aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/connection.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite/connection.ixx')
-rw-r--r--odb/sqlite/connection.ixx41
1 files changed, 39 insertions, 2 deletions
diff --git a/odb/sqlite/connection.ixx b/odb/sqlite/connection.ixx
index 87b599f..094fd52 100644
--- a/odb/sqlite/connection.ixx
+++ b/odb/sqlite/connection.ixx
@@ -1,12 +1,11 @@
// file : odb/sqlite/connection.ixx
-// copyright : Copyright (c) 2005-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
namespace odb
{
namespace sqlite
{
- // active_objects
+ // active_object
//
inline void active_object::
list_add ()
@@ -38,6 +37,36 @@ namespace odb
return static_cast<connection_factory&> (factory_).database ();
}
+ inline connection& connection::
+ main_connection ()
+ {
+ return handle_ != 0
+ ? *this
+ : *static_cast<attached_connection_factory&> (factory_).main_connection_;
+ }
+
+ inline connection_ptr connection::
+ main_connection (const connection_ptr& c)
+ {
+ return c->handle_ != 0
+ ? c
+ : static_cast<attached_connection_factory&> (c->factory_).main_connection_;
+ }
+
+ inline sqlite3* connection::
+ handle ()
+ {
+ return handle_ != 0
+ ? handle_
+ : static_cast<attached_connection_factory&> (factory_).main_connection_->handle_;
+ }
+
+ inline connection_factory& connection::
+ factory ()
+ {
+ return static_cast<connection_factory&> (factory_);
+ }
+
template <typename T>
inline prepared_query<T> connection::
prepare_query (const char* n, const char* q)
@@ -67,5 +96,13 @@ namespace odb
//
return prepare_query<T> (n, sqlite::query_base (q));
}
+
+ // attached_connection_factory
+ //
+ inline connection_factory& attached_connection_factory::
+ main_factory ()
+ {
+ return main_connection_->factory ();
+ }
}
}