From f1d06b7994d8b0aa31f86288183f46509bb78c19 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 30 Apr 2021 10:03:56 +0200 Subject: Add transaction::connection(database&) overload --- odb/transaction.cxx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'odb/transaction.cxx') diff --git a/odb/transaction.cxx b/odb/transaction.cxx index 1dc68e5..f75cf32 100644 --- a/odb/transaction.cxx +++ b/odb/transaction.cxx @@ -94,7 +94,7 @@ namespace odb finalized_ = true; rollback_guard rg (*this); - impl_->connection ().transaction_tracer_ = 0; + impl_->tracer (0); if (tls_get (current_transaction) == this) { @@ -118,7 +118,7 @@ namespace odb finalized_ = true; rollback_guard rg (*this); - impl_->connection ().transaction_tracer_ = 0; + impl_->tracer (0); if (tls_get (current_transaction) == this) { @@ -331,4 +331,26 @@ namespace odb ~transaction_impl () { } + + connection& transaction_impl:: + connection (database_type* db) + { + assert (db == 0 || db == &database_); + return *connection_; + } + + // The transaction-specific tracer is stored in the connection. See the + // connection class for the reason. + // + void transaction_impl:: + tracer (tracer_type* t) + { + connection_->transaction_tracer_ = t; + } + + tracer* transaction_impl:: + tracer () const + { + return connection_->transaction_tracer_; + } } -- cgit v1.1