diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-05-11 10:58:27 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-05-11 10:58:27 +0200 |
commit | 78e81069aadc609aee1e4b8137516d9cfce47b0a (patch) | |
tree | 98c7c4f7e4e728bb32e8f420ab3aa937ba2a3445 /odb/pgsql/transaction.cxx | |
parent | 3cdf7c4e3f6b085b4b386d4da64f3fbf396375a3 (diff) |
Add transaction implementation
Diffstat (limited to 'odb/pgsql/transaction.cxx')
-rw-r--r-- | odb/pgsql/transaction.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
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 <constantin@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <odb/pgsql/transaction.hxx> + +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<transaction_impl&> (b.implementation ()); + return reinterpret_cast<transaction&> (b); + } + } +} |