aboutsummaryrefslogtreecommitdiff
path: root/odb/mssql/polymorphic-object-result.txx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/mssql/polymorphic-object-result.txx')
-rw-r--r--odb/mssql/polymorphic-object-result.txx28
1 files changed, 19 insertions, 9 deletions
diff --git a/odb/mssql/polymorphic-object-result.txx b/odb/mssql/polymorphic-object-result.txx
index 14c7c75..a9c78c1 100644
--- a/odb/mssql/polymorphic-object-result.txx
+++ b/odb/mssql/polymorphic-object-result.txx
@@ -41,7 +41,10 @@ namespace odb
}
if (!this->end_)
+ {
statement_->free_result ();
+ this->end_ = true;
+ }
statement_.reset ();
}
@@ -50,10 +53,12 @@ namespace odb
polymorphic_object_result_impl<T>::
polymorphic_object_result_impl (const query_base&,
details::shared_ptr<select_statement> st,
- statements_type& sts)
+ statements_type& sts,
+ const schema_version_migration* svm)
: base_type (sts.connection ()),
statement_ (st),
statements_ (sts),
+ tc_ (svm),
use_copy_ (false),
image_copy_ (0)
{
@@ -134,7 +139,7 @@ namespace odb
callback_event ce (callback_event::pre_load);
pi.dispatch (info_type::call_callback, this->db_, pobj, &ce);
- object_traits::init (*pobj, i, &this->db_);
+ tc_.init (*pobj, i, &this->db_);
// If we are using a copy, make sure the callback information for
// long data also comes from the copy.
@@ -157,7 +162,7 @@ namespace odb
idb.version++;
}
- object_traits::load_ (statements_, *pobj);
+ tc_.load_ (statements_, *pobj, false);
// Load the dynamic part of the object unless static and dynamic
// types are the same.
@@ -168,7 +173,7 @@ namespace odb
pi.dispatch (info_type::call_load, this->db_, pobj, &d);
};
- rsts.load_delayed ();
+ rsts.load_delayed (tc_.version ());
l.unlock ();
ce = callback_event::post_load;
@@ -211,14 +216,16 @@ namespace odb
typedef object_traits_impl<T, id_mssql> traits;
static void
- rebind (typename traits::statements_type& sts)
+ rebind (typename traits::statements_type& sts,
+ const schema_version_migration* svm)
{
typename traits::image_type& im (sts.image ());
if (traits::check_version (sts.select_image_versions (), im))
{
binding& b (sts.select_image_binding (traits::depth));
- traits::bind (b.bind, 0, 0, im, statement_select);
+ object_traits_calls<T> tc (svm);
+ tc.bind (b.bind, 0, 0, im, statement_select);
traits::update_version (
sts.select_image_versions (), im, sts.select_image_bindings ());
}
@@ -233,14 +240,16 @@ namespace odb
typedef object_traits_impl<R, id_mssql> traits;
static void
- rebind (typename traits::statements_type& sts)
+ rebind (typename traits::statements_type& sts,
+ const schema_version_migration* svm)
{
typename traits::image_type& im (sts.image ());
if (im.version != sts.select_image_version ())
{
binding& b (sts.select_image_binding ());
- traits::bind (b.bind, im, statement_select);
+ object_traits_calls<R> tc (svm);
+ tc.bind (b.bind, im, statement_select);
sts.select_image_version (im.version);
b.version++;
}
@@ -264,7 +273,8 @@ namespace odb
}
use_copy_ = false;
- polymorphic_image_rebind<object_type, root_type>::rebind (statements_);
+ polymorphic_image_rebind<object_type, root_type>::rebind (
+ statements_, tc_.version ());
if (statement_->fetch () == select_statement::no_data)
{