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/connection.ixx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 odb/connection.ixx (limited to 'odb/connection.ixx') diff --git a/odb/connection.ixx b/odb/connection.ixx new file mode 100644 index 0000000..0e6d24c --- /dev/null +++ b/odb/connection.ixx @@ -0,0 +1,33 @@ +// file : odb/connection.ixx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include // std::string + +namespace odb +{ + inline connection:: + connection (database_type& database) + : database_ (database) + { + } + + inline connection::database_type& connection:: + database () + { + return database_; + } + + inline unsigned long long connection:: + execute (const char* st) + { + return execute (st, std::strlen (st)); + } + + inline unsigned long long connection:: + execute (const std::string& st) + { + return execute (st.c_str (), st.size ()); + } +} -- cgit v1.1