diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-06 12:05:39 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-14 15:19:49 +0200 |
commit | 09d7377f81aeb8fde4aa1698e946457f03380d45 (patch) | |
tree | eaedf7045fde8354a3693ce77edc7d5f86824e4e /odb/inline.cxx | |
parent | 548f0b10aa3adfc722198bf31f773ba85047f344 (diff) |
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.
Diffstat (limited to 'odb/inline.cxx')
-rw-r--r-- | odb/inline.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/odb/inline.cxx b/odb/inline.cxx index d6b8c32..036a728 100644 --- a/odb/inline.cxx +++ b/odb/inline.cxx @@ -107,6 +107,8 @@ traverse_object (type& c) bool abst (abstract (c)); bool reuse_abst (abst && !poly); + user_sections& uss (c.get<user_sections> ("user-sections")); + string const& type (class_fq_name (c)); string traits ("access::object_traits< " + type + " >"); @@ -269,6 +271,30 @@ traverse_object (type& c) << "function_table[db.id ()]->erase2 (db, o" << (poly ? ", true, true" : "") << ");" << "}"; + + // Sections. + // + if (uss.count (user_sections::count_total | + user_sections::count_load | + (poly ? user_sections::count_load_empty : 0)) != 0) + os << "inline" << endl + << "bool " << traits << "::" << endl + << "load (connection& c, object_type& o, section& s)" + << "{" + << "return function_table[c.database ().id ()]->load_section (" << + "c, o, s" << (poly ? ", 0" : "") << ");" + << "}"; + + if (uss.count (user_sections::count_total | + user_sections::count_update | + (poly ? user_sections::count_update_empty : 0)) != 0) + os << "inline" << endl + << "bool " << traits << "::" << endl + << "update (connection& c, const object_type& o, const section& s)" + << "{" + << "return function_table[c.database ().id ()]->update_section (" << + "c, o, s" << (poly ? ", 0" : "") << ");" + << "}"; } if (options.generate_query ()) |