diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-26 11:29:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-26 11:29:05 +0200 |
commit | 8e046e3ea7e88f872205c2b65cb7f9b86aaabd93 (patch) | |
tree | aba1ae331454eb1e0cf9525faf8a084d3652bda0 /odb/validator.cxx | |
parent | 6c88333c2e0232aed9e0b3c9077306f09e36c65c (diff) |
Make session optional
Diffstat (limited to 'odb/validator.cxx')
-rw-r--r-- | odb/validator.cxx | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/odb/validator.cxx b/odb/validator.cxx index d346b25..eac5086 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -1047,7 +1047,7 @@ namespace if (id != 0) { - if (semantics::class_* c = composite_wrapper (utype (*id))) + if (semantics::class_* cm = composite_wrapper (utype (*id))) { // Composite id cannot be auto. // @@ -1065,7 +1065,7 @@ namespace // if (valid_) { - composite_id_members_.traverse (*c); + composite_id_members_.traverse (*cm); if (!valid_) os << id->file () << ":" << id->line () << ":" << id->column () @@ -1074,28 +1074,29 @@ namespace // Check that the composite value type is default-constructible. // - if (!c->default_ctor ()) + if (!cm->default_ctor ()) { - os << c->file () << ":" << c->line () << ":" << c->column () + os << cm->file () << ":" << cm->line () << ":" << cm->column () << ": error: composite value type that is used as object id " << "is not default-constructible" << endl; - os << c->file () << ":" << c->line () << ":" << c->column () - << ": info: provide default constructor for this value type" - << endl; + os << cm->file () << ":" << cm->line () << ":" << cm->column () + << ": info: provide default constructor for this value type" + << endl; - os << id->file () << ":" << id->line () << ":" << id->column () - << ": info: composite id is defined here" << endl; + os << id->file () << ":" << id->line () << ":" << id->column () + << ": info: composite id is defined here" << endl; - valid_ = false; + valid_ = false; } - // Check that composite values can be compared (used in session). + // If this is a session object, make sure that the composite + // value can be compared. // - if (has_lt_operator_ != 0) + if (session (c) && has_lt_operator_ != 0) { tree args (make_tree_vec (1)); - TREE_VEC_ELT (args, 0) = c->tree_node (); + TREE_VEC_ELT (args, 0) = cm->tree_node (); tree inst ( instantiate_template ( @@ -1126,17 +1127,21 @@ namespace if (!v) { - os << c->file () << ":" << c->line () << ":" << c->column () + os << cm->file () << ":" << cm->line () << ":" << cm->column () << ": error: composite value type that is used as object id " - << "does not support the less than (<) comparison" + << "in persistent class with session support does not " + << "define the less than (<) comparison" << endl; - os << c->file () << ":" << c->line () << ":" << c->column () + os << cm->file () << ":" << cm->line () << ":" << cm->column () << ": info: provide operator< for this value type" << endl; os << id->file () << ":" << id->line () << ":" << id->column () << ": info: composite id is defined here" << endl; + os << c.file () << ":" << c.line () << ":" << c.column () + << ": info: persistent class is defined here" << endl; + valid_ = false; } } |