aboutsummaryrefslogtreecommitdiff
path: root/odb/tracer/database.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/tracer/database.cxx')
-rw-r--r--odb/tracer/database.cxx40
1 files changed, 40 insertions, 0 deletions
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 <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <odb/session.hxx>
+#include <odb/transaction.hxx>
+#include <odb/tracer/database.hxx>
+
+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);
+ }
+ }
+}