diff options
Diffstat (limited to 'odb/mysql/polymorphic-object-result.txx')
-rw-r--r-- | odb/mysql/polymorphic-object-result.txx | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/odb/mysql/polymorphic-object-result.txx b/odb/mysql/polymorphic-object-result.txx index b84ac36..8072b37 100644 --- a/odb/mysql/polymorphic-object-result.txx +++ b/odb/mysql/polymorphic-object-result.txx @@ -38,10 +38,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), count_ (0) { } @@ -128,7 +130,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_); // Initialize the id image and binding and load the rest of the object // (containers, dynamic part, etc). @@ -144,7 +146,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. @@ -155,7 +157,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; @@ -235,14 +237,16 @@ namespace odb typedef object_traits_impl<T, id_mysql> traits; static bool - 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 ()); return true; @@ -260,14 +264,16 @@ namespace odb typedef object_traits_impl<R, id_mysql> traits; static bool - 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++; return true; @@ -287,7 +293,7 @@ namespace odb // to fetch() as a result of other statements execution. // if (statement_->cached ()) - image_rebind::rebind (statements_); + image_rebind::rebind (statements_, tc_.version ()); while (!this->end_ && (!next || count_ > statement_->fetched ())) { @@ -304,11 +310,10 @@ namespace odb typename object_traits::image_type& im (statements_.image ()); - if (object_traits::grow (im, - statements_.select_image_truncated ())) + if (tc_.grow (im, statements_.select_image_truncated ())) im.version++; - if (image_rebind::rebind (statements_)) + if (image_rebind::rebind (statements_, tc_.version ())) statement_->refetch (); // Fall throught. |