diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-14 15:16:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-14 15:16:09 +0200 |
commit | ab52a8c4e7f92358cabf1c81de3ddcc68c1b7090 (patch) | |
tree | 7e6dd48b43410d5577efe1944cf04900b122430f | |
parent | 4077a3636154b8638daf34992a34475f3ba8de5d (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.
-rw-r--r-- | odb/qt/containers/list-traits.hxx | 3 | ||||
-rw-r--r-- | odb/qt/containers/list-traits.txx | 28 |
2 files changed, 31 insertions, 0 deletions
diff --git a/odb/qt/containers/list-traits.hxx b/odb/qt/containers/list-traits.hxx index 17e7765..6541d3f 100644 --- a/odb/qt/containers/list-traits.hxx +++ b/odb/qt/containers/list-traits.hxx @@ -64,6 +64,9 @@ namespace odb c._start (); } + static bool + changed (const container_type&); + static void update (const container_type&, const functions&); diff --git a/odb/qt/containers/list-traits.txx b/odb/qt/containers/list-traits.txx index 2893236..8af5c85 100644 --- a/odb/qt/containers/list-traits.txx +++ b/odb/qt/containers/list-traits.txx @@ -5,6 +5,34 @@ namespace odb { template <typename V> + bool access::container_traits<QOdbList<V> >:: + changed (const container_type& c) + { + // Because modifications can cancel each other (e.g., push and pop), + // it is tricky to keep track of whether there are any changes in + // the container. Instead, we are just going to examine each element + // just like update(). + // + + // We should either be tracking or summarily changed. + // + if (c._tracking ()) + { + const vector_impl& impl (c._impl ()); + + for (std::size_t i (0), n (impl.size ()); i < n; ++i) + { + if (impl.state (i) != vector_impl::state_unchanged) + return true; + } + } + else + return true; + + return false; + } + + template <typename V> void access::container_traits<QOdbList<V> >:: update (const container_type& c, const functions& f) { |