aboutsummaryrefslogtreecommitdiff
path: root/odb/tracer/connection.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-21 16:27:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-21 16:27:34 +0200
commitbde4f5c3bddb437c5238bcb6dd2311bc57600ef1 (patch)
treee25658cc26cf40318847c60e8de01ac1720bd18a /odb/tracer/connection.hxx
parent4c78c4b1e1a826a85468a4125813cec3dcbbbd06 (diff)
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.
Diffstat (limited to 'odb/tracer/connection.hxx')
-rw-r--r--odb/tracer/connection.hxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/odb/tracer/connection.hxx b/odb/tracer/connection.hxx
new file mode 100644
index 0000000..743bf92
--- /dev/null
+++ b/odb/tracer/connection.hxx
@@ -0,0 +1,44 @@
+// file : odb/tracer/connection.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_TRACER_CONNECTION_HXX
+#define ODB_TRACER_CONNECTION_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/connection.hxx>
+#include <odb/details/shared-ptr.hxx>
+
+#include <odb/tracer/transaction-impl.hxx>
+#include <odb/tracer/details/export.hxx>
+
+namespace odb
+{
+ namespace tracer
+ {
+ class database;
+
+ class connection;
+ typedef details::shared_ptr<connection> connection_ptr;
+
+ class LIBODB_TRACER_EXPORT connection: public odb::connection
+ {
+ public:
+ typedef tracer::database database_type;
+
+ connection (database_type&);
+
+ virtual unsigned long long
+ execute (const char* statement, std::size_t length);
+
+ virtual transaction_impl*
+ begin ();
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_TRACER_CONNECTION_HXX