summaryrefslogtreecommitdiff
path: root/libodb-oracle/odb/oracle/transaction.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-02-01 15:47:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-02-01 15:47:37 +0300
commit62e234c114d2b6ead93a1d39593c66b648c3d0a6 (patch)
treece6740b4508eb29400490b20efc8e100e38a7b7f /libodb-oracle/odb/oracle/transaction.cxx
parent9072842a023c4b65ecb141292c4b63417fee1b98 (diff)
Turn libodb-oracle repository into package for muti-package repositorylibodb-oracle
Diffstat (limited to 'libodb-oracle/odb/oracle/transaction.cxx')
-rw-r--r--libodb-oracle/odb/oracle/transaction.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/libodb-oracle/odb/oracle/transaction.cxx b/libodb-oracle/odb/oracle/transaction.cxx
new file mode 100644
index 0000000..6dff1a0
--- /dev/null
+++ b/libodb-oracle/odb/oracle/transaction.cxx
@@ -0,0 +1,26 @@
+// file : odb/oracle/transaction.cxx
+// license : ODB NCUEL; see accompanying LICENSE file
+
+#include <cassert>
+
+#include <odb/oracle/transaction.hxx>
+
+namespace odb
+{
+ namespace oracle
+ {
+ transaction& transaction::
+ current ()
+ {
+ // While the impl type can be of the concrete type, the transaction
+ // object can be created as either odb:: or odb::oracle:: type. To
+ // work around that we are going to hard-cast one to the other
+ // relying on the fact that they have the same representation and
+ // no virtual functions. The former is checked in the tests.
+ //
+ odb::transaction& b (odb::transaction::current ());
+ assert (dynamic_cast<transaction_impl*> (&b.implementation ()) != 0);
+ return reinterpret_cast<transaction&> (b);
+ }
+ }
+}