From ee570de4bd013fd2a4351d33d11539621f00bf57 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/pgsql/database.ixx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'odb/pgsql/database.ixx') diff --git a/odb/pgsql/database.ixx b/odb/pgsql/database.ixx index a4f5040..467f765 100644 --- a/odb/pgsql/database.ixx +++ b/odb/pgsql/database.ixx @@ -7,10 +7,20 @@ namespace odb { namespace pgsql { - inline details::shared_ptr database:: + inline connection_ptr database:: connection () { - return factory_->connect (); + // Go through the virtual connection_() function instead of + // directly to allow overriding. + // + return connection_ptr ( + static_cast (connection_ ())); + } + + inline transaction_impl* database:: + begin () + { + return connection ()->begin (); } } } -- cgit v1.1