diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-21 16:27:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-21 16:27:34 +0200 |
commit | 5b6649e6f7dd256147b48197a007c23001cef647 (patch) | |
tree | debffbb24e00bc485f9675cbc5be08ec1cc8eea9 /odb/connection.ixx | |
parent | 1e63b60696f2e3012221e3bf6430a0d66ce1ba34 (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/connection.ixx')
-rw-r--r-- | odb/connection.ixx | 33 |
1 files changed, 33 insertions, 0 deletions
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 <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <cstring> // 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 ()); + } +} |