aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-24 12:19:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-24 12:19:54 +0200
commitea1fb7db74c17ce64403b4350d93f18d41c31f81 (patch)
tree2eb415b864ea2a0a690c8cc1a80795b0d5f477ba
parent48c1630764665072bbb592f7072e48aa654a1c71 (diff)
Add image/binding versioning
-rw-r--r--odb/sqlite/container-statements.hxx56
-rw-r--r--odb/sqlite/container-statements.txx8
-rw-r--r--odb/sqlite/object-statements.hxx40
-rw-r--r--odb/sqlite/object-statements.txx7
4 files changed, 110 insertions, 1 deletions
diff --git a/odb/sqlite/container-statements.hxx b/odb/sqlite/container-statements.hxx
index a114990..5f5caef 100644
--- a/odb/sqlite/container-statements.hxx
+++ b/odb/sqlite/container-statements.hxx
@@ -8,6 +8,8 @@
#include <odb/pre.hxx>
+#include <cstddef> // std::size_t
+
#include <odb/forward.hxx>
#include <odb/traits.hxx>
@@ -80,6 +82,30 @@ namespace odb
return cond_image_;
}
+ std::size_t
+ cond_image_version () const
+ {
+ return cond_image_version_;
+ }
+
+ void
+ cond_image_version (std::size_t v)
+ {
+ cond_image_version_ = v;
+ }
+
+ std::size_t
+ cond_id_image_version () const
+ {
+ return cond_id_image_version_;
+ }
+
+ void
+ cond_id_image_version (std::size_t v)
+ {
+ cond_id_image_version_ = v;
+ }
+
binding&
cond_image_binding ()
{
@@ -94,6 +120,30 @@ namespace odb
return data_image_;
}
+ std::size_t
+ data_image_version () const
+ {
+ return data_image_version_;
+ }
+
+ void
+ data_image_version (std::size_t v)
+ {
+ data_image_version_ = v;
+ }
+
+ std::size_t
+ data_id_image_version () const
+ {
+ return data_id_image_version_;
+ }
+
+ void
+ data_id_image_version (std::size_t v)
+ {
+ data_id_image_version_ = v;
+ }
+
binding&
data_image_binding ()
{
@@ -103,7 +153,7 @@ namespace odb
bool*
data_image_truncated ()
{
- return data_image_truncation_;
+ return data_image_truncated_;
}
//
@@ -157,10 +207,14 @@ namespace odb
id_image_type* id_image_;
cond_image_type cond_image_;
+ std::size_t cond_image_version_;
+ std::size_t cond_id_image_version_;
binding cond_image_binding_;
bind cond_image_bind_[traits::cond_column_count];
data_image_type data_image_;
+ std::size_t data_image_version_;
+ std::size_t data_id_image_version_;
binding data_image_binding_;
bind data_image_bind_[traits::data_column_count];
bool data_image_truncated_[traits::data_column_count];
diff --git a/odb/sqlite/container-statements.txx b/odb/sqlite/container-statements.txx
index 23466df..bfef187 100644
--- a/odb/sqlite/container-statements.txx
+++ b/odb/sqlite/container-statements.txx
@@ -25,6 +25,14 @@ namespace odb
cond_image_binding_ (cond_image_bind_, traits::cond_column_count),
data_image_binding_ (data_image_bind_, traits::data_column_count)
{
+ cond_image_.version = 0;
+ cond_image_version_ = 0;
+ cond_id_image_version_ = 0;
+
+ data_image_.version = 0;
+ data_image_version_ = 0;
+ data_id_image_version_ = 0;
+
std::memset (cond_image_bind_, 0, sizeof (cond_image_bind_));
std::memset (data_image_bind_, 0, sizeof (data_image_bind_));
std::memset (data_image_truncated_, 0, sizeof (data_image_truncated_));
diff --git a/odb/sqlite/object-statements.hxx b/odb/sqlite/object-statements.hxx
index 73f3162..68fd04e 100644
--- a/odb/sqlite/object-statements.hxx
+++ b/odb/sqlite/object-statements.hxx
@@ -10,6 +10,7 @@
#include <vector>
#include <cassert>
+#include <cstddef> // std::size_t
#include <odb/forward.hxx>
#include <odb/traits.hxx>
@@ -171,6 +172,30 @@ namespace odb
return image_;
}
+ std::size_t
+ in_image_version () const
+ {
+ return in_image_version_;
+ }
+
+ std::size_t
+ out_image_version () const
+ {
+ return out_image_version_;
+ }
+
+ void
+ in_image_version (std::size_t v)
+ {
+ in_image_version_ = v;
+ }
+
+ void
+ out_image_version (std::size_t v)
+ {
+ out_image_version_ = v;
+ }
+
binding&
in_image_binding ()
{
@@ -197,6 +222,18 @@ namespace odb
return id_image_;
}
+ std::size_t
+ id_image_version () const
+ {
+ return id_image_version_;
+ }
+
+ void
+ id_image_version (std::size_t v)
+ {
+ id_image_version_ = v;
+ }
+
binding&
id_image_binding ()
{
@@ -283,11 +320,13 @@ namespace odb
// In (send) binding. The last element is the id parameter.
//
+ std::size_t in_image_version_;
binding in_image_binding_;
bind in_image_bind_[object_traits::in_column_count + 1];
// Out (receive) binding.
//
+ std::size_t out_image_version_;
binding out_image_binding_;
bind out_image_bind_[object_traits::out_column_count];
bool out_image_truncated_[object_traits::out_column_count];
@@ -295,6 +334,7 @@ namespace odb
// Id image binding (only in).
//
id_image_type id_image_;
+ std::size_t id_image_version_;
binding id_image_binding_;
details::shared_ptr<persist_statement_type> persist_;
diff --git a/odb/sqlite/object-statements.txx b/odb/sqlite/object-statements.txx
index 88b99e8..53a157f 100644
--- a/odb/sqlite/object-statements.txx
+++ b/odb/sqlite/object-statements.txx
@@ -24,6 +24,13 @@ namespace odb
out_image_binding_ (out_image_bind_, object_traits::out_column_count),
id_image_binding_ (in_image_bind_ + object_traits::in_column_count, 1)
{
+ image_.version = 0;
+ in_image_version_ = 0;
+ out_image_version_ = 0;
+
+ id_image_.version = 0;
+ id_image_version_ = 0;
+
std::memset (in_image_bind_, 0, sizeof (in_image_bind_));
std::memset (out_image_bind_, 0, sizeof (out_image_bind_));
std::memset (out_image_truncated_, 0, sizeof (out_image_truncated_));