From 5b6649e6f7dd256147b48197a007c23001cef647 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/database.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'odb/database.cxx') diff --git a/odb/database.cxx b/odb/database.cxx index 89f0260..ca6c7cc 100644 --- a/odb/database.cxx +++ b/odb/database.cxx @@ -11,4 +11,14 @@ namespace odb ~database () { } + + unsigned long long database:: + execute (const char* st, std::size_t n) + { + if (!transaction::has_current ()) + throw not_in_transaction (); + + connection_type& c (transaction::current ().connection ()); + return c.execute (st, n); + } } -- cgit v1.1