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 | c3a2b62f33e1f3fe19700257efdba7123b272cc4 (patch) | |
tree | 281f2275a2a7202c24bf114532adcd5752eaf19d /odb/mysql/no-id-object-result.txx | |
parent | 9126281b53722115b2e8624632f2dd616f0c26a0 (diff) |
Implement early connection release
Diffstat (limited to 'odb/mysql/no-id-object-result.txx')
-rw-r--r-- | odb/mysql/no-id-object-result.txx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/odb/mysql/no-id-object-result.txx b/odb/mysql/no-id-object-result.txx index 530eeb7..6bcad44 100644 --- a/odb/mysql/no-id-object-result.txx +++ b/odb/mysql/no-id-object-result.txx @@ -20,11 +20,24 @@ namespace odb } template <typename T> + void no_id_object_result_impl<T>:: + invalidate () + { + if (!this->end_) + { + statement_->free_result (); + this->end_ = true; + } + + statement_.reset (); + } + + template <typename T> no_id_object_result_impl<T>:: no_id_object_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) @@ -38,11 +51,9 @@ namespace odb if (count_ > statement_->fetched ()) fetch (); - odb::database& db (this->database ()); - - object_traits::callback (db, obj, callback_event::pre_load); - object_traits::init (obj, statements_.image (), &db); - object_traits::callback (db, obj, callback_event::post_load); + object_traits::callback (this->db_, obj, callback_event::pre_load); + object_traits::init (obj, statements_.image (), &this->db_); + object_traits::callback (this->db_, obj, callback_event::post_load); } template <typename T> |