From 78e81069aadc609aee1e4b8137516d9cfce47b0a Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Wed, 11 May 2011 10:58:27 +0200 Subject: Add transaction implementation --- odb/pgsql/transaction.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 odb/pgsql/transaction.cxx (limited to 'odb/pgsql/transaction.cxx') diff --git a/odb/pgsql/transaction.cxx b/odb/pgsql/transaction.cxx new file mode 100644 index 0000000..2632318 --- /dev/null +++ b/odb/pgsql/transaction.cxx @@ -0,0 +1,26 @@ +// file : odb/pgsql/transaction.cxx +// author : Constantin Michael +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include + +namespace odb +{ + namespace pgsql + { + transaction& transaction:: + current () + { + // While the impl type can be of the concrete type, the transaction + // object can be created as either odb:: or odb::pgsql:: 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 ()); + dynamic_cast (b.implementation ()); + return reinterpret_cast (b); + } + } +} -- cgit v1.1