aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/database.cxx4
-rw-r--r--odb/mysql/database.ixx2
-rw-r--r--odb/mysql/polymorphic-object-statements.txx2
-rw-r--r--odb/mysql/transaction-impl.hxx5
-rw-r--r--odb/mysql/transaction-impl.ixx14
-rw-r--r--odb/mysql/transaction.hxx3
-rw-r--r--odb/mysql/transaction.ixx8
7 files changed, 15 insertions, 23 deletions
diff --git a/odb/mysql/database.cxx b/odb/mysql/database.cxx
index d1ba3fd..6c0f1d6 100644
--- a/odb/mysql/database.cxx
+++ b/odb/mysql/database.cxx
@@ -305,7 +305,9 @@ namespace odb
cp = factory_->connect ();
mysql::connection& c (
- cp != 0 ? *cp : transaction::current ().connection ());
+ cp != 0
+ ? *cp
+ : transaction::current ().connection (const_cast<database&> (*this)));
try
{
diff --git a/odb/mysql/database.ixx b/odb/mysql/database.ixx
index 711dd46..f9b62dd 100644
--- a/odb/mysql/database.ixx
+++ b/odb/mysql/database.ixx
@@ -601,7 +601,7 @@ namespace odb
{
// Throws if not in transaction.
//
- mysql::connection& c (transaction::current ().connection ());
+ mysql::connection& c (transaction::current ().connection (*this));
return c.prepare_query<T> (n, q);
}
diff --git a/odb/mysql/polymorphic-object-statements.txx b/odb/mysql/polymorphic-object-statements.txx
index 1217a0a..5899bc0 100644
--- a/odb/mysql/polymorphic-object-statements.txx
+++ b/odb/mysql/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/mysql/transaction-impl.hxx b/odb/mysql/transaction-impl.hxx
index a83f68d..d87ad35 100644
--- a/odb/mysql/transaction-impl.hxx
+++ b/odb/mysql/transaction-impl.hxx
@@ -38,17 +38,12 @@ namespace odb
virtual void
rollback ();
- connection_type&
- connection ();
-
private:
connection_ptr connection_;
};
}
}
-#include <odb/mysql/transaction-impl.ixx>
-
#include <odb/post.hxx>
#endif // ODB_MYSQL_TRANSACTION_IMPL_HXX
diff --git a/odb/mysql/transaction-impl.ixx b/odb/mysql/transaction-impl.ixx
deleted file mode 100644
index 3951aed..0000000
--- a/odb/mysql/transaction-impl.ixx
+++ /dev/null
@@ -1,14 +0,0 @@
-// file : odb/mysql/transaction-impl.ixx
-// license : GNU GPL v2; see accompanying LICENSE file
-
-namespace odb
-{
- namespace mysql
- {
- inline transaction_impl::connection_type& transaction_impl::
- connection ()
- {
- return *connection_;
- }
- }
-}
diff --git a/odb/mysql/transaction.hxx b/odb/mysql/transaction.hxx
index 3cfd042..0f5ae6f 100644
--- a/odb/mysql/transaction.hxx
+++ b/odb/mysql/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/mysql/transaction.ixx b/odb/mysql/transaction.ixx
index 068b184..15af6a5 100644
--- a/odb/mysql/transaction.ixx
+++ b/odb/mysql/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::