From e5d0186db99492a139237067bab841a5b83463af Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 24 Jan 2024 19:01:19 +0300 Subject: Turn libodb-sqlite repository into package for muti-package repository --- libodb-sqlite/odb/sqlite/transaction.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 libodb-sqlite/odb/sqlite/transaction.cxx (limited to 'libodb-sqlite/odb/sqlite/transaction.cxx') diff --git a/libodb-sqlite/odb/sqlite/transaction.cxx b/libodb-sqlite/odb/sqlite/transaction.cxx new file mode 100644 index 0000000..8b4ab23 --- /dev/null +++ b/libodb-sqlite/odb/sqlite/transaction.cxx @@ -0,0 +1,26 @@ +// file : odb/sqlite/transaction.cxx +// license : GNU GPL v2; see accompanying LICENSE file + +#include + +#include + +namespace odb +{ + namespace sqlite + { + transaction& transaction:: + current () + { + // While the impl type can be of the concrete type, the transaction + // object can be created as either odb:: or odb::sqlite:: type. To + // work around that we are going to hard-cast one two 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 (&b.implementation ()) != 0); + return reinterpret_cast (b); + } + } +} -- cgit v1.1