From e4b2a3484d7a640ff84803e0d9374c93063a151e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Oct 2012 13:17:30 +0200 Subject: Implement early connection release --- odb/pgsql/no-id-object-result.txx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'odb/pgsql/no-id-object-result.txx') diff --git a/odb/pgsql/no-id-object-result.txx b/odb/pgsql/no-id-object-result.txx index e9682b2..c406155 100644 --- a/odb/pgsql/no-id-object-result.txx +++ b/odb/pgsql/no-id-object-result.txx @@ -19,11 +19,24 @@ namespace odb } template + void no_id_object_result_impl:: + invalidate () + { + if (!this->end_) + { + statement_->free_result (); + this->end_ = true; + } + + statement_.reset (); + } + + template no_id_object_result_impl:: no_id_object_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), count_ (0) @@ -64,11 +77,9 @@ namespace odb } } - odb::database& db (this->database ()); - - object_traits::callback (db, obj, callback_event::pre_load); - object_traits::init (obj, im, &db); - object_traits::callback (db, obj, callback_event::post_load); + object_traits::callback (this->db_, obj, callback_event::pre_load); + object_traits::init (obj, im, &this->db_); + object_traits::callback (this->db_, obj, callback_event::post_load); } template -- cgit v1.1