aboutsummaryrefslogtreecommitdiff
path: root/odb/processor.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-04 12:57:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-04 12:57:25 +0200
commitc93d7f6453f8aebdc80fba44032f692eb5da8a9c (patch)
tree441f2828cd354d925087a8728cab9a3ecfe8eee4 /odb/processor.cxx
parenta7094314a7f3c7453025061efeacb0d52e1866af (diff)
Container versioning support
Diffstat (limited to 'odb/processor.cxx')
-rw-r--r--odb/processor.cxx52
1 files changed, 47 insertions, 5 deletions
diff --git a/odb/processor.cxx b/odb/processor.cxx
index 8c4efaf..14370c4 100644
--- a/odb/processor.cxx
+++ b/odb/processor.cxx
@@ -1657,12 +1657,54 @@ namespace
t.set ("key-not-null", true);
}
- // Check if we are versioned.
+ // Check if we are versioned. For now we are not allowing for
+ // soft-add/delete in container keys (might be used in WHERE,
+ // primary key).
//
- // @@ TODO
- //
- if (force_versioned)
- t.set ("versioned", true);
+ {
+ semantics::class_* comp;
+ switch (ck)
+ {
+ case ck_ordered:
+ {
+ comp = composite (*vt);
+ break;
+ }
+ case ck_map:
+ case ck_multimap:
+ {
+ comp = composite (*kt);
+ if (comp == 0 || column_count (*comp).soft == 0)
+ {
+ comp = composite (*vt);
+ break;
+ }
+
+ error (m.location ()) << "map key type cannot have soft-" <<
+ "added/deleted data members" << endl;
+ info (kt->location ()) << "key type is defined here" << endl;
+ throw operation_failed ();
+ }
+ case ck_set:
+ case ck_multiset:
+ {
+ comp = composite (*vt);
+ if (comp == 0 || column_count (*comp).soft == 0)
+ {
+ comp = 0;
+ break;
+ }
+
+ error (m.location ()) << "set value type cannot have soft-" <<
+ "added/deleted data members" << endl;
+ info (vt->location ()) << "value type is defined here" << endl;
+ throw operation_failed ();
+ }
+ }
+
+ if (force_versioned || (comp != 0 && column_count (*comp).soft != 0))
+ t.set ("versioned", true);
+ }
}
// Process member data.