aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/object-result.txx
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/object-result.txx
parent3f956d7933f94c535da368e11a9a65a899344c2a (diff)
Use RAII to free select statement results
Diffstat (limited to 'odb/pgsql/object-result.txx')
-rw-r--r--odb/pgsql/object-result.txx10
1 files changed, 10 insertions, 0 deletions
diff --git a/odb/pgsql/object-result.txx b/odb/pgsql/object-result.txx
index 3a20e2d..c5334cc 100644
--- a/odb/pgsql/object-result.txx
+++ b/odb/pgsql/object-result.txx
@@ -20,6 +20,8 @@ namespace odb
object_result_impl<T>::
~object_result_impl ()
{
+ if (!this->end_)
+ statement_->free_result ();
}
template <typename T>
@@ -87,7 +89,10 @@ namespace odb
this->current (pointer_type ());
if (!statement_->next ())
+ {
+ statement_->free_result ();
this->end_ = true;
+ }
}
template <typename T>
@@ -146,6 +151,8 @@ namespace odb
object_result_impl_no_id<T>::
~object_result_impl_no_id ()
{
+ if (!this->end_)
+ statement_->free_result ();
}
template <typename T>
@@ -207,7 +214,10 @@ namespace odb
this->current (pointer_type ());
if (!statement_->next ())
+ {
+ statement_->free_result ();
this->end_ = true;
+ }
}
template <typename T>