From 93cb54135cd7b214ded868d0277f2f4d5eca0e2c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Oct 2012 13:17:31 +0200 Subject: Implement early connection release --- odb/oracle/view-result.txx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'odb/oracle/view-result.txx') diff --git a/odb/oracle/view-result.txx b/odb/oracle/view-result.txx index 248ef76..8dbe8d0 100644 --- a/odb/oracle/view-result.txx +++ b/odb/oracle/view-result.txx @@ -15,6 +15,13 @@ namespace odb view_result_impl:: ~view_result_impl () { + invalidate (); + } + + template + void view_result_impl:: + invalidate () + { change_callback_type& cc (statements_.image ().change_callback_); if (cc.context == this) @@ -24,9 +31,15 @@ namespace odb } delete image_copy_; + image_copy_ = 0; if (!this->end_) + { statement_->free_result (); + this->end_ = true; + } + + statement_.reset (); } template @@ -34,7 +47,7 @@ namespace odb view_result_impl (const query_base&, details::shared_ptr statement, statements_type& statements) - : base_type (statements.connection ().database ()), + : base_type (statements.connection ()), statement_ (statement), statements_ (statements), use_copy_ (false), @@ -46,13 +59,11 @@ namespace odb void view_result_impl:: load (view_type& view) { - odb::database& db (this->database ()); - - view_traits::callback (db, view, callback_event::pre_load); + view_traits::callback (this->db_, view, callback_event::pre_load); view_traits::init (view, use_copy_ ? *image_copy_ : statements_.image (), - &db); + &this->db_); // If we are using a copy, make sure the callback information for // LOB data also comes from the copy. @@ -61,7 +72,7 @@ namespace odb use_copy_ ? &statements_.image () : 0, use_copy_ ? image_copy_ : 0); - view_traits::callback (db, view, callback_event::post_load); + view_traits::callback (this->db_, view, callback_event::post_load); } template -- cgit v1.1