diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-15 13:17:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-19 11:40:30 +0200 |
commit | 8112bd0febcfa1e3a76e0d03363facbefc3822f7 (patch) | |
tree | 0f5a05b9b29ae7d77e95f7831c214b385aaf6a3b /odb/sqlite/simple-object-result.txx | |
parent | d94948b8bccfd8748245726487d54c41bb199baf (diff) |
Implement early connection release
Diffstat (limited to 'odb/sqlite/simple-object-result.txx')
-rw-r--r-- | odb/sqlite/simple-object-result.txx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/odb/sqlite/simple-object-result.txx b/odb/sqlite/simple-object-result.txx index 6763850..1de4b91 100644 --- a/odb/sqlite/simple-object-result.txx +++ b/odb/sqlite/simple-object-result.txx @@ -22,11 +22,25 @@ namespace odb } template <typename T> + void object_result_impl<T>:: + invalidate () + { + if (!this->end_) + { + statement_->free_result (); + this->end_ = true; + } + + params_.reset (); + statement_.reset (); + } + + template <typename T> object_result_impl<T>:: object_result_impl (const query_base& q, const details::shared_ptr<select_statement>& statement, statements_type& statements) - : base_type (statements.connection ().database ()), + : base_type (statements.connection ()), result_impl_base (q, statement), statements_ (statements) { @@ -44,11 +58,10 @@ namespace odb assert (!statements_.locked ()); typename statements_type::auto_lock l (statements_); - odb::database& db (this->database ()); - object_traits::callback (db, obj, callback_event::pre_load); + object_traits::callback (this->db_, obj, callback_event::pre_load); typename object_traits::image_type& i (statements_.image ()); - object_traits::init (obj, i, &db); + object_traits::init (obj, i, &this->db_); // Initialize the id image and binding and load the rest of the object // (containers, etc). @@ -67,7 +80,7 @@ namespace odb object_traits::load_ (statements_, obj); statements_.load_delayed (); l.unlock (); - object_traits::callback (db, obj, callback_event::post_load); + object_traits::callback (this->db_, obj, callback_event::post_load); } template <typename T> |