aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/pgsql/database.cxx19
-rw-r--r--odb/pgsql/database.hxx25
2 files changed, 26 insertions, 18 deletions
diff --git a/odb/pgsql/database.cxx b/odb/pgsql/database.cxx
index 445af44..6a65780 100644
--- a/odb/pgsql/database.cxx
+++ b/odb/pgsql/database.cxx
@@ -17,6 +17,8 @@ namespace odb
{
namespace pgsql
{
+ using odb::details::transfer_ptr;
+
database::
database (const string& user,
const string& password,
@@ -24,14 +26,14 @@ namespace odb
const string& host,
unsigned int port,
const string& extra_conninfo,
- auto_ptr<connection_factory> factory)
+ transfer_ptr<connection_factory> factory)
: user_ (user),
password_ (password),
db_ (db),
host_ (host),
port_ (port),
extra_conninfo_ (extra_conninfo),
- factory_ (factory)
+ factory_ (factory.transfer ())
{
ostringstream ss;
@@ -71,7 +73,7 @@ namespace odb
const string& host,
const string& socket_ext,
const string& extra_conninfo,
- auto_ptr<connection_factory> factory)
+ transfer_ptr<connection_factory> factory)
: user_ (user),
password_ (password),
db_ (db),
@@ -79,7 +81,7 @@ namespace odb
port_ (0),
socket_ext_ (socket_ext),
extra_conninfo_ (extra_conninfo),
- factory_ (factory)
+ factory_ (factory.transfer ())
{
ostringstream ss;
@@ -113,9 +115,8 @@ namespace odb
}
database::
- database (const string& conninfo,
- auto_ptr<connection_factory> factory)
- : port_ (0), conninfo_ (conninfo), factory_ (factory)
+ database (const string& conninfo, transfer_ptr<connection_factory> factory)
+ : port_ (0), conninfo_ (conninfo), factory_ (factory.transfer ())
{
if (factory_.get () == 0)
factory_.reset (new connection_pool_factory ());
@@ -128,8 +129,8 @@ namespace odb
char* argv[],
bool erase,
const string& extra_conninfo,
- auto_ptr<connection_factory> factory)
- : port_ (0), factory_ (factory)
+ transfer_ptr<connection_factory> factory)
+ : port_ (0), factory_ (factory.transfer ())
{
using namespace details;
diff --git a/odb/pgsql/database.hxx b/odb/pgsql/database.hxx
index 89984b3..c3b42f2 100644
--- a/odb/pgsql/database.hxx
+++ b/odb/pgsql/database.hxx
@@ -8,10 +8,12 @@
#include <odb/pre.hxx>
#include <string>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr, std::unique_ptr
#include <iosfwd> // std::ostream
#include <odb/database.hxx>
+#include <odb/details/config.hxx> // ODB_CXX11
+#include <odb/details/transfer-ptr.hxx>
#include <odb/pgsql/version.hxx>
#include <odb/pgsql/forward.hxx>
@@ -36,8 +38,8 @@ namespace odb
const std::string& host = "",
unsigned int port = 0,
const std::string& extra_conninfo = "",
- std::auto_ptr<connection_factory> factory =
- std::auto_ptr<connection_factory> (0));
+ details::transfer_ptr<connection_factory> =
+ details::transfer_ptr<connection_factory> ());
database (const std::string& user,
const std::string& password,
@@ -45,13 +47,13 @@ namespace odb
const std::string& host = "",
const std::string& socket_ext = "",
const std::string& extra_conninfo = "",
- std::auto_ptr<connection_factory> factory =
- std::auto_ptr<connection_factory> (0));
+ details::transfer_ptr<connection_factory> =
+ details::transfer_ptr<connection_factory> ());
explicit
database (const std::string& conninfo,
- std::auto_ptr<connection_factory> =
- std::auto_ptr<connection_factory> (0));
+ details::transfer_ptr<connection_factory> =
+ details::transfer_ptr<connection_factory> ());
// Extract the database parameters from the command line. The
// following options are recognized:
@@ -72,8 +74,8 @@ namespace odb
char* argv[],
bool erase = false,
const std::string& extra_conninfo = "",
- std::auto_ptr<connection_factory> =
- std::auto_ptr<connection_factory> (0));
+ details::transfer_ptr<connection_factory> =
+ details::transfer_ptr<connection_factory> ());
static void
print_usage (std::ostream&);
@@ -173,7 +175,12 @@ namespace odb
std::string socket_ext_;
std::string extra_conninfo_;
std::string conninfo_;
+
+#ifdef ODB_CXX11
+ std::unique_ptr<connection_factory> factory_;
+#else
std::auto_ptr<connection_factory> factory_;
+#endif
};
}
}