aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/section-statements.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-08-14 15:16:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-08-14 15:16:09 +0200
commit075f64ca84e4e1be22bad30e4974e9b675d12ec8 (patch)
treeec157ade131adf217d9c2dcd47228bc8c7b53cb9 /odb/mysql/section-statements.txx
parent7f55357c16a981ae2d2d4b1ea2d1cfdcff1bdf74 (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/mysql/section-statements.txx')
-rw-r--r--odb/mysql/section-statements.txx42
1 files changed, 42 insertions, 0 deletions
diff --git a/odb/mysql/section-statements.txx b/odb/mysql/section-statements.txx
new file mode 100644
index 0000000..282551c
--- /dev/null
+++ b/odb/mysql/section-statements.txx
@@ -0,0 +1,42 @@
+// file : odb/mysql/section-statements.txx
+// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <cstring> // std::memset
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <typename T, typename ST>
+ section_statements<T, ST>::
+ section_statements (connection_type& conn,
+ image_type& im,
+ binding& id, binding& idv)
+ : conn_ (conn),
+ image_ (im),
+ id_binding_ (id),
+ idv_binding_ (idv),
+ select_image_binding_ (select_image_bind_,
+ select_column_count +
+ managed_optimistic_load_column_count),
+ update_image_binding_ (update_image_bind_,
+ update_column_count + id_column_count +
+ managed_optimistic_update_column_count)
+ {
+ select_image_version_ = 0;
+ update_image_version_ = 0;
+ update_id_binding_version_ = 0;
+
+ std::memset (select_image_bind_, 0, sizeof (select_image_bind_));
+ std::memset (
+ select_image_truncated_, 0, sizeof (select_image_truncated_));
+ std::memset (update_image_bind_, 0, sizeof (update_image_bind_));
+
+ for (std::size_t i (0);
+ i < select_column_count + managed_optimistic_load_column_count;
+ ++i)
+ select_image_bind_[i].error = select_image_truncated_ + i;
+ }
+ }
+}