From bde4f5c3bddb437c5238bcb6dd2311bc57600ef1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 21 Aug 2011 16:27:34 +0200 Subject: Add odb::connection class This abstract class represents a connection to the database. One can use it to start a transaction or to execute a native statement out of a transaction. Before we had concrete connection classes in the database runtime libraries (e.g., odb::mysql::connection). Now these classes derive from odb::connection. --- odb/tracer/connection.cxx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 odb/tracer/connection.cxx (limited to 'odb/tracer/connection.cxx') diff --git a/odb/tracer/connection.cxx b/odb/tracer/connection.cxx new file mode 100644 index 0000000..516e36a --- /dev/null +++ b/odb/tracer/connection.cxx @@ -0,0 +1,37 @@ +// file : odb/tracer/connection.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include + +#include +#include + +namespace odb +{ + namespace tracer + { + connection:: + connection (database_type& db) + : odb::connection (db) + { + } + + unsigned long long connection:: + execute (const char*, std::size_t) + { + return 0; + } + + transaction_impl* connection:: + begin () + { + if (odb::transaction::has_current ()) + throw already_in_transaction (); + + return new transaction_impl ( + connection_ptr (inc_ref (this))); + } + } +} -- cgit v1.1