summaryrefslogtreecommitdiff
path: root/odb/oracle/simple-object-result.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:17:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:17:31 +0200
commit93cb54135cd7b214ded868d0277f2f4d5eca0e2c (patch)
treeffa41df34bace2691d383e013fdb3d3b0a9c1ccf /odb/oracle/simple-object-result.txx
parent0051807a6c28dd0ebb425d05511fbf9127483ee1 (diff)
Implement early connection release
Diffstat (limited to 'odb/oracle/simple-object-result.txx')
-rw-r--r--odb/oracle/simple-object-result.txx24
1 files changed, 18 insertions, 6 deletions
diff --git a/odb/oracle/simple-object-result.txx b/odb/oracle/simple-object-result.txx
index b36eb3b..345de38 100644
--- a/odb/oracle/simple-object-result.txx
+++ b/odb/oracle/simple-object-result.txx
@@ -17,18 +17,31 @@ namespace odb
object_result_impl<T>::
~object_result_impl ()
{
+ invalidate ();
+ }
+
+ template <typename T>
+ void object_result_impl<T>::
+ invalidate ()
+ {
change_callback_type& cc (statements_.image ().change_callback_);
if (cc.context == this)
{
- cc.context = 0;
cc.callback = 0;
+ cc.context = 0;
}
delete image_copy_;
+ image_copy_ = 0;
if (!this->end_)
+ {
statement_->free_result ();
+ this->end_ = true;
+ }
+
+ statement_.reset ();
}
template <typename T>
@@ -36,7 +49,7 @@ namespace odb
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),
use_copy_ (false),
@@ -53,13 +66,12 @@ 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 (
use_copy_ ? *image_copy_ : statements_.image ());
- object_traits::init (obj, i, &db);
+ object_traits::init (obj, i, &this->db_);
// If we are using a copy, make sure the callback information for
// LOB data also comes from the copy.
@@ -85,7 +97,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>