diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-04 16:45:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-04 16:45:36 +0200 |
commit | fcfe083c7a6d12eb4b6b88eea4a5ebbfc4d36995 (patch) | |
tree | ba60af2863d425e8be78749558c73910ab2f921d /odb/mysql/transaction.cxx | |
parent | 073918a2f4bff3a6f12cfd722db50e3fb0a6db0d (diff) |
Initial implementation
Diffstat (limited to 'odb/mysql/transaction.cxx')
-rw-r--r-- | odb/mysql/transaction.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/odb/mysql/transaction.cxx b/odb/mysql/transaction.cxx new file mode 100644 index 0000000..ac8cd04 --- /dev/null +++ b/odb/mysql/transaction.cxx @@ -0,0 +1,26 @@ +// file : odb/mysql/transaction.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <odb/mysql/transaction.hxx> + +namespace odb +{ + namespace mysql + { + transaction& transaction:: + current () + { + // While the impl type can be of the concrete type, the transaction + // object can be created as either odb:: or odb::mysql:: 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 ()); + dynamic_cast<transaction_impl&> (b.implementation ()); + return reinterpret_cast<transaction&> (b); + } + } +} |