aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/polymorphic-object-result.txx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/oracle/polymorphic-object-result.txx')
-rw-r--r--odb/oracle/polymorphic-object-result.txx29
1 files changed, 22 insertions, 7 deletions
diff --git a/odb/oracle/polymorphic-object-result.txx b/odb/oracle/polymorphic-object-result.txx
index 9db06cc..7635403 100644
--- a/odb/oracle/polymorphic-object-result.txx
+++ b/odb/oracle/polymorphic-object-result.txx
@@ -17,6 +17,13 @@ namespace odb
polymorphic_object_result_impl<T>::
~polymorphic_object_result_impl ()
{
+ invalidate ();
+ }
+
+ template <typename T>
+ void polymorphic_object_result_impl<T>::
+ invalidate ()
+ {
change_callback_type& cc (
statements_.root_statements ().image ().change_callback_);
@@ -27,10 +34,18 @@ namespace odb
}
if (image_copy_ != 0)
+ {
object_traits::free_image (image_copy_);
+ image_copy_ = 0;
+ }
if (!this->end_)
+ {
statement_->free_result ();
+ this->end_ = true;
+ }
+
+ statement_.reset ();
}
template <typename T>
@@ -38,7 +53,7 @@ namespace odb
polymorphic_object_result_impl (const query_base&,
details::shared_ptr<select_statement> st,
statements_type& sts)
- : base_type (sts.connection ().database ()),
+ : base_type (sts.connection ()),
statement_ (st),
statements_ (sts),
use_copy_ (false),
@@ -58,7 +73,6 @@ namespace odb
assert (!rsts.locked ());
typename statements_type::auto_lock l (rsts);
- odb::database& db (this->database ());
image_type& i (use_copy_ ? *image_copy_ : statements_.image ());
typename root_traits::image_type& ri (
use_copy_ ? object_traits::root_image (i) : rsts.image ());
@@ -95,7 +109,8 @@ namespace odb
// Insert it as a root pointer (for non-unique pointers, rp should
// still be valid and for unique pointers this is a no-op).
//
- ig.reset (object_traits::pointer_cache_traits::insert (db, id, rp));
+ ig.reset (
+ object_traits::pointer_cache_traits::insert (this->db_, id, rp));
pobj = &pointer_traits::get_ref (p);
current (p);
@@ -116,9 +131,9 @@ namespace odb
}
callback_event ce (callback_event::pre_load);
- pi.dispatch (info_type::call_callback, db, pobj, &ce);
+ pi.dispatch (info_type::call_callback, this->db_, pobj, &ce);
- object_traits::init (*pobj, i, &db);
+ object_traits::init (*pobj, i, &this->db_);
// If we are using a copy, make sure the callback information for
// LOB data also comes from the copy.
@@ -149,14 +164,14 @@ namespace odb
if (&pi != &object_traits::info)
{
std::size_t d (object_traits::depth);
- pi.dispatch (info_type::call_load, db, pobj, &d);
+ pi.dispatch (info_type::call_load, this->db_, pobj, &d);
};
rsts.load_delayed ();
l.unlock ();
ce = callback_event::post_load;
- pi.dispatch (info_type::call_callback, db, pobj, &ce);
+ pi.dispatch (info_type::call_callback, this->db_, pobj, &ce);
ig.release ();
}