diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-09 18:14:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-09 18:14:37 +0200 |
commit | 0bf77eaad1fb2ad23f9aec64ea0fe3ab7cf06a28 (patch) | |
tree | 49d0ff8ee2f193c9eabfc67b06f1a2134d21a8b3 /odb/mssql/database.ixx | |
parent | ea61e19c6c0a52be4740448d0d21605e090b460d (diff) |
Make database class move-constructible
This means it can be returned by value from a function in C++11.
Diffstat (limited to 'odb/mssql/database.ixx')
-rw-r--r-- | odb/mssql/database.ixx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/odb/mssql/database.ixx b/odb/mssql/database.ixx index 6558339..e90da54 100644 --- a/odb/mssql/database.ixx +++ b/odb/mssql/database.ixx @@ -2,12 +2,38 @@ // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC // license : ODB NCUEL; see accompanying LICENSE file +#include <utility> // move() + #include <odb/mssql/transaction.hxx> namespace odb { namespace mssql { +#ifdef ODB_CXX11 + inline database:: + database (database&& db) // Has to be inline. + : odb::database (std::move (db)), + user_ (std::move (db.user_)), + password_ (std::move (db.password_)), + db_ (std::move (db.db_)), + protocol_ (db.protocol_), + host_ (std::move (db.host_)), + instance_ (std::move (db.instance_)), + port_ (db.port_), + server_ (std::move (db.server_)), + driver_ (std::move (db.driver_)), + extra_connect_string_ (std::move (db.extra_connect_string_)), + transaction_isolation_ (db.transaction_isolation_), + connect_string_ (std::move (db.connect_string_)), + auto_environment_ (std::move (db.auto_environment_)), + environment_ (db.environment_), + factory_ (std::move (db.factory_)) + { + factory_->database (*this); // New database instance. + } +#endif + inline connection_ptr database:: connection () { |