diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-07 10:21:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-07 10:21:08 +0200 |
commit | 7d52205f2b2fc9403b9ea46483e8a17746c6be35 (patch) | |
tree | 588d4ab4e730c3c3d72dcc0cdf98769eae61afdb /odb/sqlite/statement.hxx | |
parent | 2de569a55b9fc25142844f88d35f7b6d2d3fb53c (diff) |
Use RAII to free select statement results
Diffstat (limited to 'odb/sqlite/statement.hxx')
-rw-r--r-- | odb/sqlite/statement.hxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/sqlite/statement.hxx b/odb/sqlite/statement.hxx index cf94c71..0ed8aa8 100644 --- a/odb/sqlite/statement.hxx +++ b/odb/sqlite/statement.hxx @@ -294,6 +294,19 @@ namespace odb binding& result_; }; + struct LIBODB_SQLITE_EXPORT auto_result + { + explicit auto_result (select_statement& s): s_ (s) {} + ~auto_result () {s_.free_result ();} + + private: + auto_result (const auto_result&); + auto_result& operator= (const auto_result&); + + private: + select_statement& s_; + }; + class LIBODB_SQLITE_EXPORT insert_statement: public statement { public: |