aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/section-statements.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-05-06 12:05:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-08-14 15:19:13 +0200
commit0745f84e2d5c7133f6ee6608487089d69d7ad519 (patch)
treebcba1aee153c18ef58396c86632de35360fb5950 /odb/pgsql/section-statements.txx
parent79ccdd960976729e2d46e2d476f54b92c5348a5f (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/pgsql/section-statements.txx')
-rw-r--r--odb/pgsql/section-statements.txx52
1 files changed, 52 insertions, 0 deletions
diff --git a/odb/pgsql/section-statements.txx b/odb/pgsql/section-statements.txx
new file mode 100644
index 0000000..d4463d1
--- /dev/null
+++ b/odb/pgsql/section-statements.txx
@@ -0,0 +1,52 @@
+// file : odb/pgsql/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 pgsql
+ {
+ template <typename T, typename ST>
+ section_statements<T, ST>::
+ section_statements (connection_type& conn,
+ image_type& im,
+ binding& id,
+ binding& idv,
+ native_binding& idn,
+ const Oid* idt)
+ : conn_ (conn),
+ image_ (im),
+ id_binding_ (id),
+ idv_binding_ (idv),
+ id_native_binding_ (idn),
+ id_types_ (idt),
+ 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),
+ update_image_native_binding_ (update_image_values_,
+ update_image_lengths_,
+ update_image_formats_,
+ 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].truncated = select_image_truncated_ + i;
+ }
+ }
+}