aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite')
-rw-r--r--odb/sqlite/database.cxx12
-rw-r--r--odb/sqlite/database.hxx17
2 files changed, 20 insertions, 9 deletions
diff --git a/odb/sqlite/database.cxx b/odb/sqlite/database.cxx
index 6bd3636..cd62a1c 100644
--- a/odb/sqlite/database.cxx
+++ b/odb/sqlite/database.cxx
@@ -18,6 +18,8 @@ namespace odb
{
namespace sqlite
{
+ using odb::details::transfer_ptr;
+
database::
~database ()
{
@@ -27,11 +29,11 @@ namespace odb
database (const string& name,
int flags,
bool foreign_keys,
- auto_ptr<connection_factory> factory)
+ transfer_ptr<connection_factory> factory)
: name_ (name),
flags_ (flags),
foreign_keys_ (foreign_keys),
- factory_ (factory)
+ factory_ (factory.transfer ())
{
if (factory_.get () == 0)
factory_.reset (new connection_pool_factory ());
@@ -45,8 +47,10 @@ namespace odb
bool erase,
int flags,
bool foreign_keys,
- std::auto_ptr<connection_factory> factory)
- : flags_ (flags), foreign_keys_ (foreign_keys), factory_ (factory)
+ transfer_ptr<connection_factory> factory)
+ : flags_ (flags),
+ foreign_keys_ (foreign_keys),
+ factory_ (factory.transfer ())
{
using namespace details;
diff --git a/odb/sqlite/database.hxx b/odb/sqlite/database.hxx
index ba0e2c2..d2bf61f 100644
--- a/odb/sqlite/database.hxx
+++ b/odb/sqlite/database.hxx
@@ -10,10 +10,12 @@
#include <sqlite3.h>
#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/sqlite/version.hxx>
#include <odb/sqlite/forward.hxx>
@@ -36,8 +38,8 @@ namespace odb
database (const std::string& name,
int flags = SQLITE_OPEN_READWRITE,
bool foreign_keys = true,
- 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:
@@ -58,8 +60,8 @@ namespace odb
bool erase = false,
int flags = SQLITE_OPEN_READWRITE,
bool foreign_keys = true,
- 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&);
@@ -131,7 +133,12 @@ namespace odb
std::string name_;
int flags_;
bool foreign_keys_;
+
+#ifdef ODB_CXX11
+ std::unique_ptr<connection_factory> factory_;
+#else
std::auto_ptr<connection_factory> factory_;
+#endif
};
}
}