From dac72baef46897b80fc98632cef182fb266a5d60 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 21 Mar 2011 17:24:35 +0200 Subject: Add base SQLite database classes --- odb/sqlite/transaction.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 odb/sqlite/transaction.cxx (limited to 'odb/sqlite/transaction.cxx') diff --git a/odb/sqlite/transaction.cxx b/odb/sqlite/transaction.cxx new file mode 100644 index 0000000..6690d92 --- /dev/null +++ b/odb/sqlite/transaction.cxx @@ -0,0 +1,26 @@ +// file : odb/sqlite/transaction.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#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 ()); + dynamic_cast (b.implementation ()); + return reinterpret_cast (b); + } + } +} -- cgit v1.1