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 | ee570de4bd013fd2a4351d33d11539621f00bf57 (patch) | |
tree | 48a7857b2e5fcf799ae4773cbd61252b76ec7512 /odb/pgsql/connection.hxx | |
parent | 6e3ac760696d4ec43138b1aba82426582c767072 (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/pgsql/connection.hxx')
-rw-r--r-- | odb/pgsql/connection.hxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/odb/pgsql/connection.hxx b/odb/pgsql/connection.hxx index 6914d5b..2e7679c 100644 --- a/odb/pgsql/connection.hxx +++ b/odb/pgsql/connection.hxx @@ -12,11 +12,13 @@ #include <memory> // std::auto_ptr #include <odb/forward.hxx> +#include <odb/connection.hxx> #include <odb/details/shared-ptr.hxx> #include <odb/pgsql/version.hxx> #include <odb/pgsql/forward.hxx> +#include <odb/pgsql/transaction-impl.hxx> #include <odb/pgsql/pgsql-fwd.hxx> // PGconn #include <odb/pgsql/details/export.hxx> @@ -28,7 +30,10 @@ namespace odb class statement; class statement_cache; - class LIBODB_PGSQL_EXPORT connection: public details::shared_base + class connection; + typedef details::shared_ptr<connection> connection_ptr; + + class LIBODB_PGSQL_EXPORT connection: public odb::connection { public: typedef pgsql::statement_cache statement_cache_type; @@ -46,6 +51,22 @@ namespace odb } public: + virtual transaction_impl* + begin (); + + transaction_impl* + begin_immediate (); + + transaction_impl* + begin_exclusive (); + + public: + using odb::connection::execute; + + virtual unsigned long long + execute (const char* statement, std::size_t length); + + public: PGconn* handle () { |