aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/database.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
commitee570de4bd013fd2a4351d33d11539621f00bf57 (patch)
tree48a7857b2e5fcf799ae4773cbd61252b76ec7512 /odb/pgsql/database.hxx
parent6e3ac760696d4ec43138b1aba82426582c767072 (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/database.hxx')
-rw-r--r--odb/pgsql/database.hxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/odb/pgsql/database.hxx b/odb/pgsql/database.hxx
index b4917cc..d3d8f7d 100644
--- a/odb/pgsql/database.hxx
+++ b/odb/pgsql/database.hxx
@@ -20,7 +20,6 @@
#include <odb/pgsql/forward.hxx>
#include <odb/pgsql/connection.hxx>
#include <odb/pgsql/connection-factory.hxx>
-#include <odb/pgsql/transaction-impl.hxx>
#include <odb/pgsql/details/export.hxx>
@@ -28,12 +27,11 @@ namespace odb
{
namespace pgsql
{
+ class transaction_impl;
+
class LIBODB_PGSQL_EXPORT database: public odb::database
{
public:
- typedef pgsql::connection connection_type;
-
- public:
database (const std::string& user,
const std::string& password,
const std::string& db,
@@ -82,23 +80,24 @@ namespace odb
static void
print_usage (std::ostream&);
+ // Transactions.
+ //
public:
- using odb::database::execute;
- virtual unsigned long long
- execute (const char* statement, std::size_t length);
-
- public:
- virtual transaction_impl*
+ transaction_impl*
begin ();
public:
- details::shared_ptr<connection_type>
+ connection_ptr
connection ();
public:
virtual
~database ();
+ protected:
+ virtual odb::connection*
+ connection_ ();
+
public:
const std::string&
user () const