diff options
Diffstat (limited to 'odb/sqlite')
-rw-r--r-- | odb/sqlite/database.cxx | 4 | ||||
-rw-r--r-- | odb/sqlite/database.ixx | 2 | ||||
-rw-r--r-- | odb/sqlite/polymorphic-object-statements.txx | 2 | ||||
-rw-r--r-- | odb/sqlite/transaction-impl.hxx | 5 | ||||
-rw-r--r-- | odb/sqlite/transaction-impl.ixx | 14 | ||||
-rw-r--r-- | odb/sqlite/transaction.hxx | 3 | ||||
-rw-r--r-- | odb/sqlite/transaction.ixx | 8 |
7 files changed, 15 insertions, 23 deletions
diff --git a/odb/sqlite/database.cxx b/odb/sqlite/database.cxx index 96fab8d..c15c633 100644 --- a/odb/sqlite/database.cxx +++ b/odb/sqlite/database.cxx @@ -225,7 +225,9 @@ namespace odb cp = factory_->connect (); sqlite::connection& c ( - cp != 0 ? *cp : transaction::current ().connection ()); + cp != 0 + ? *cp + : transaction::current ().connection (const_cast<database&> (*this))); try { diff --git a/odb/sqlite/database.ixx b/odb/sqlite/database.ixx index c72d2f9..d5302a1 100644 --- a/odb/sqlite/database.ixx +++ b/odb/sqlite/database.ixx @@ -590,7 +590,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); } diff --git a/odb/sqlite/polymorphic-object-statements.txx b/odb/sqlite/polymorphic-object-statements.txx index f2a1605..6a376d3 100644 --- a/odb/sqlite/polymorphic-object-statements.txx +++ b/odb/sqlite/polymorphic-object-statements.txx @@ -116,7 +116,7 @@ namespace odb root_type& robj, const schema_version_migration* svm) { - connection_type& conn (transaction::current ().connection ()); + connection_type& conn (transaction::current ().connection (db)); polymorphic_derived_object_statements& sts ( conn.statement_cache ().find_object<object_type> ()); root_statements_type& rsts (sts.root_statements ()); diff --git a/odb/sqlite/transaction-impl.hxx b/odb/sqlite/transaction-impl.hxx index 818270a..040bcd7 100644 --- a/odb/sqlite/transaction-impl.hxx +++ b/odb/sqlite/transaction-impl.hxx @@ -45,9 +45,6 @@ namespace odb virtual void rollback (); - connection_type& - connection (); - private: connection_ptr connection_; lock lock_; @@ -55,8 +52,6 @@ namespace odb } } -#include <odb/sqlite/transaction-impl.ixx> - #include <odb/post.hxx> #endif // ODB_SQLITE_TRANSACTION_IMPL_HXX diff --git a/odb/sqlite/transaction-impl.ixx b/odb/sqlite/transaction-impl.ixx deleted file mode 100644 index c49fedb..0000000 --- a/odb/sqlite/transaction-impl.ixx +++ /dev/null @@ -1,14 +0,0 @@ -// file : odb/sqlite/transaction-impl.ixx -// license : GNU GPL v2; see accompanying LICENSE file - -namespace odb -{ - namespace sqlite - { - inline transaction_impl::connection_type& transaction_impl:: - connection () - { - return *connection_; - } - } -} diff --git a/odb/sqlite/transaction.hxx b/odb/sqlite/transaction.hxx index 01df7d4..5e8c141 100644 --- a/odb/sqlite/transaction.hxx +++ b/odb/sqlite/transaction.hxx @@ -40,6 +40,9 @@ namespace odb connection_type& connection (); + connection_type& + connection (odb::database&); + // Return current transaction or throw if there is no transaction // in effect. // diff --git a/odb/sqlite/transaction.ixx b/odb/sqlite/transaction.ixx index 0528cec..de4bd3e 100644 --- a/odb/sqlite/transaction.ixx +++ b/odb/sqlite/transaction.ixx @@ -39,7 +39,13 @@ namespace odb inline transaction::connection_type& transaction:: connection () { - return implementation ().connection (); + return static_cast<connection_type&> (odb::transaction::connection ()); + } + + inline transaction::connection_type& transaction:: + connection (odb::database& db) + { + return static_cast<connection_type&> (odb::transaction::connection (db)); } inline void transaction:: |