From 91830e3bd38a05c73d03a5dfb88997799d44274b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 May 2013 12:05:39 +0200 Subject: Add support for object sections Sections are an optimization mechanism that allows the partitioning of data members of a persistent class into groups that can be separately loaded and/or updated. --- odb/polymorphic-map.hxx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'odb/polymorphic-map.hxx') diff --git a/odb/polymorphic-map.hxx b/odb/polymorphic-map.hxx index 5c3e434..3c0883f 100644 --- a/odb/polymorphic-map.hxx +++ b/odb/polymorphic-map.hxx @@ -149,7 +149,8 @@ namespace odb }; template - bool dispatch_impl ( + bool + dispatch_impl ( typename polymorphic_concrete_info< typename object_traits::root_type>::call_type c, database& db, @@ -235,6 +236,37 @@ namespace odb return r; } + + template + void + section_load_impl (odb::connection& conn, + typename object_traits::root_type& obj, + bool top) + { + typedef object_traits_impl derived_traits; + typedef typename derived_traits::statements_type statements_type; + typedef typename statements_type::connection_type connection_type; + + connection_type& c (static_cast (conn)); + statements_type& sts (c.statement_cache ().template find_object ()); + + ST::load (sts.extra_statement_cache (), static_cast (obj), top); + } + + template + void + section_update_impl (odb::connection& conn, + const typename object_traits::root_type& obj) + { + typedef object_traits_impl derived_traits; + typedef typename derived_traits::statements_type statements_type; + typedef typename statements_type::connection_type connection_type; + + connection_type& c (static_cast (conn)); + statements_type& sts (c.statement_cache ().template find_object ()); + + ST::update (sts.extra_statement_cache (), static_cast (obj)); + } } #include -- cgit v1.1