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 | 476f21938f75553d6bff5e8780b537f7182c5675 (patch) | |
tree | 27bc4afb2c6a8a673dee0eebeedcf4d7090b5437 /odb/oracle/auto-handle.hxx | |
parent | 56a8e716a30df1c894e6ccfa16c4a0bfb43baa9c (diff) |
Make database class move-constructible
This means it can be returned by value from a function in C++11.
Diffstat (limited to 'odb/oracle/auto-handle.hxx')
-rw-r--r-- | odb/oracle/auto-handle.hxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/odb/oracle/auto-handle.hxx b/odb/oracle/auto-handle.hxx index cdbda4f..f764fe2 100644 --- a/odb/oracle/auto-handle.hxx +++ b/odb/oracle/auto-handle.hxx @@ -7,6 +7,8 @@ #include <odb/pre.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 + #include <odb/oracle/version.hxx> #include <odb/oracle/oracle-fwd.hxx> @@ -125,6 +127,16 @@ namespace odb h_ = h; } +#ifdef ODB_CXX11 + auto_handle (auto_handle&& ah): h_ (ah.release ()) {} + auto_handle& operator= (auto_handle&& ah) + { + if (this != &ah) + reset (ah.release ()); + return *this; + } +#endif + private: auto_handle (const auto_handle&); auto_handle& operator= (const auto_handle&); @@ -198,6 +210,10 @@ namespace odb } private: + auto_handle (const auto_handle&); + auto_handle& operator= (const auto_handle&); + + private: OCISvcCtx* h_; OCIError* e_; }; @@ -259,6 +275,10 @@ namespace odb } private: + auto_handle (const auto_handle&); + auto_handle& operator= (const auto_handle&); + + private: OCIStmt* h_; ub4 release_mode_; OCIError* e_; |