From 60fcae9f4843a34908207ece658aed041fcfd722 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Mar 2012 12:34:41 +0200 Subject: Add support for using C++11 std::unique_ptr to pass connection factory --- odb/mssql/database.hxx | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'odb/mssql/database.hxx') diff --git a/odb/mssql/database.hxx b/odb/mssql/database.hxx index 5be36b4..3ad09a9 100644 --- a/odb/mssql/database.hxx +++ b/odb/mssql/database.hxx @@ -8,10 +8,12 @@ #include #include -#include // std::auto_ptr +#include // std::auto_ptr, std::unique_ptr #include // std::ostream #include +#include // ODB_CXX11 +#include #include #include @@ -54,8 +56,8 @@ namespace odb const std::string& driver = "", const std::string& extra_connect_string = "", SQLHENV environment = 0, - std::auto_ptr factory = - std::auto_ptr (0)); + details::transfer_ptr = + details::transfer_ptr ()); // By default connect to the default instance on localhost using // default protocol and the latest available SQL Server Native @@ -72,8 +74,8 @@ namespace odb const std::string& driver = "", const std::string& extra_connect_string = "", SQLHENV environment = 0, - std::auto_ptr factory = - std::auto_ptr (0)); + details::transfer_ptr = + details::transfer_ptr ()); // Connect using TCP/IP to the specified host and port. If port is // 0, use the default port (1433). @@ -86,16 +88,16 @@ namespace odb const std::string& driver = "", const std::string& extra_connect_string = "", SQLHENV environment = 0, - std::auto_ptr factory = - std::auto_ptr (0)); + details::transfer_ptr = + details::transfer_ptr ()); // Connect using a custom SQL Server Native Client ODBC driver // conection string. // database (const std::string& connect_string, SQLHENV environment = 0, - std::auto_ptr factory = - std::auto_ptr (0)); + details::transfer_ptr = + details::transfer_ptr ()); // Extract the database parameters from the command line. The // following options are recognized: @@ -117,8 +119,8 @@ namespace odb bool erase = false, const std::string& extra_connect_string = "", SQLHENV environment = 0, - std::auto_ptr = - std::auto_ptr (0)); + details::transfer_ptr = + details::transfer_ptr ()); static void print_usage (std::ostream&); @@ -251,7 +253,11 @@ namespace odb auto_handle auto_environment_; SQLHENV environment_; +#ifdef ODB_CXX11 + std::unique_ptr factory_; +#else std::auto_ptr factory_; +#endif }; } } -- cgit v1.1