diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-15 13:17:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-15 13:17:30 +0200 |
commit | e4b2a3484d7a640ff84803e0d9374c93063a151e (patch) | |
tree | 367314821b69717f2c96856163dd874cedd5a110 /odb/pgsql/view-result.txx | |
parent | fef380f6c9a5fb9904d551478fe180a9c5d24b37 (diff) |
Implement early connection release
Diffstat (limited to 'odb/pgsql/view-result.txx')
-rw-r--r-- | odb/pgsql/view-result.txx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/odb/pgsql/view-result.txx b/odb/pgsql/view-result.txx index d596e7c..0d89fbe 100644 --- a/odb/pgsql/view-result.txx +++ b/odb/pgsql/view-result.txx @@ -19,11 +19,24 @@ namespace odb } template <typename T> + void view_result_impl<T>:: + invalidate () + { + if (!this->end_) + { + statement_->free_result (); + this->end_ = true; + } + + statement_.reset (); + } + + template <typename T> view_result_impl<T>:: view_result_impl (const query_base&, details::shared_ptr<select_statement> statement, statements_type& statements) - : base_type (statements.connection ().database ()), + : base_type (statements.connection ()), statement_ (statement), statements_ (statements), count_ (0) @@ -64,11 +77,9 @@ namespace odb } } - odb::database& db (this->database ()); - - view_traits::callback (db, view, callback_event::pre_load); - view_traits::init (view, im, &db); - view_traits::callback (db, view, callback_event::post_load); + view_traits::callback (this->db_, view, callback_event::pre_load); + view_traits::init (view, im, &this->db_); + view_traits::callback (this->db_, view, callback_event::post_load); } template <typename T> |