diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-04-30 12:05:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-04-30 12:08:17 +0200 |
commit | 3e35d69611534c57f06bfc7ec11f505ba97c8aab (patch) | |
tree | a167f0acf8bf35bf32dfafe4c226b65b66fae394 | |
parent | a8e11c5e5688f53cd9ac5af6dffe9a3db0dffba7 (diff) |
Add transaction::connection(database&) overload
-rw-r--r-- | odb/oracle/database.cxx | 4 | ||||
-rw-r--r-- | odb/oracle/database.ixx | 2 | ||||
-rw-r--r-- | odb/oracle/polymorphic-object-statements.txx | 2 | ||||
-rw-r--r-- | odb/oracle/transaction-impl.hxx | 5 | ||||
-rw-r--r-- | odb/oracle/transaction-impl.ixx | 14 | ||||
-rw-r--r-- | odb/oracle/transaction.hxx | 3 | ||||
-rw-r--r-- | odb/oracle/transaction.ixx | 8 |
7 files changed, 15 insertions, 23 deletions
diff --git a/odb/oracle/database.cxx b/odb/oracle/database.cxx index a141fa0..3b720be 100644 --- a/odb/oracle/database.cxx +++ b/odb/oracle/database.cxx @@ -304,7 +304,9 @@ namespace odb cp = factory_->connect (); oracle::connection& c ( - cp != 0 ? *cp : transaction::current ().connection ()); + cp != 0 + ? *cp + : transaction::current ().connection (const_cast<database&> (*this))); try { diff --git a/odb/oracle/database.ixx b/odb/oracle/database.ixx index c416b00..ea41aca 100644 --- a/odb/oracle/database.ixx +++ b/odb/oracle/database.ixx @@ -624,7 +624,7 @@ namespace odb { // Throws if not in transaction. // - oracle::connection& c (transaction::current ().connection ()); + oracle::connection& c (transaction::current ().connection (*this)); return c.prepare_query<T> (n, q); } diff --git a/odb/oracle/polymorphic-object-statements.txx b/odb/oracle/polymorphic-object-statements.txx index 96ff18a..9d190e5 100644 --- a/odb/oracle/polymorphic-object-statements.txx +++ b/odb/oracle/polymorphic-object-statements.txx @@ -107,7 +107,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/oracle/transaction-impl.hxx b/odb/oracle/transaction-impl.hxx index 5fe3edf..0b7e9bf 100644 --- a/odb/oracle/transaction-impl.hxx +++ b/odb/oracle/transaction-impl.hxx @@ -39,17 +39,12 @@ namespace odb virtual void rollback (); - connection_type& - connection (); - private: connection_ptr connection_; }; } } -#include <odb/oracle/transaction-impl.ixx> - #include <odb/post.hxx> #endif // ODB_ORACLE_TRANSACTION_IMPL_HXX diff --git a/odb/oracle/transaction-impl.ixx b/odb/oracle/transaction-impl.ixx deleted file mode 100644 index 1c80b10..0000000 --- a/odb/oracle/transaction-impl.ixx +++ /dev/null @@ -1,14 +0,0 @@ -// file : odb/oracle/transaction-impl.ixx -// license : ODB NCUEL; see accompanying LICENSE file - -namespace odb -{ - namespace oracle - { - inline transaction_impl::connection_type& transaction_impl:: - connection () - { - return *connection_; - } - } -} diff --git a/odb/oracle/transaction.hxx b/odb/oracle/transaction.hxx index 057167c..8d06b2f 100644 --- a/odb/oracle/transaction.hxx +++ b/odb/oracle/transaction.hxx @@ -41,6 +41,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/oracle/transaction.ixx b/odb/oracle/transaction.ixx index 4f09505..d75a399 100644 --- a/odb/oracle/transaction.ixx +++ b/odb/oracle/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:: |