From eef022894e7d6f1f371da432722a733b98fd8709 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Jun 2010 16:36:21 +0200 Subject: Initial implementation --- odb/tracer/database.cxx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 odb/tracer/database.cxx (limited to 'odb/tracer/database.cxx') diff --git a/odb/tracer/database.cxx b/odb/tracer/database.cxx new file mode 100644 index 0000000..5d59c16 --- /dev/null +++ b/odb/tracer/database.cxx @@ -0,0 +1,40 @@ +// file : odb/tracer/database.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include +#include +#include + +namespace odb +{ + namespace tracer + { + database:: + ~database () + { + } + + transaction_impl* database:: + begin_transaction () + { + if (odb::transaction::has_current ()) + throw already_in_transaction (); + + if (session::has_current ()) + return new transaction_impl (*this, session::current ()); + else + return new transaction_impl (*this); + } + + transaction_impl* database:: + begin_transaction (session& s) + { + if (odb::transaction::has_current ()) + throw already_in_transaction (); + + return new transaction_impl (*this, s); + } + } +} -- cgit v1.1