aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/statement.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-03-07 10:21:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-03-07 10:21:08 +0200
commit3405fff26a02b5bee51686c5d22200be320b87d8 (patch)
tree73f2f216b7803e335c6280e94cb1103c1a825935 /odb/pgsql/statement.hxx
parent3f956d7933f94c535da368e11a9a65a899344c2a (diff)
Use RAII to free select statement results
Diffstat (limited to 'odb/pgsql/statement.hxx')
-rw-r--r--odb/pgsql/statement.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/pgsql/statement.hxx b/odb/pgsql/statement.hxx
index c643687..94fceb6 100644
--- a/odb/pgsql/statement.hxx
+++ b/odb/pgsql/statement.hxx
@@ -209,6 +209,19 @@ namespace odb
std::size_t current_row_;
};
+ struct LIBODB_PGSQL_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_PGSQL_EXPORT insert_statement: public statement
{
public: