diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-10-27 15:16:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-10-27 15:16:49 +0200 |
commit | 8d82c02a90cd7cc3f161828624db5b973585c34c (patch) | |
tree | 7b04f0b5e1b9e6eb3a2e76395df6a132be7a78d0 /odb/relational/processor.cxx | |
parent | 9d10c570acf1b7e8ed7c0a750ae3edfa70da200b (diff) |
Add support for persistent classes without object ids
New pragma id (object). New test: common/no-id.
Diffstat (limited to 'odb/relational/processor.cxx')
-rw-r--r-- | odb/relational/processor.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index fdddf9a..d0587ca 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -851,6 +851,20 @@ namespace relational throw operation_failed (); } + // Make sure the pointed-to class has object id. + // + if (context::id_member (*c) == 0) + { + os << m.file () << ":" << m.line () << ":" << m.column () << ": " + << "error: pointed-to class '" << c->fq_name () << "' " + << "has no object id" << endl; + + os << c->file () << ":" << c->line () << ":" << c->column () << ": " + << "info: class '" << c->name () << "' is defined here" << endl; + + throw operation_failed (); + } + // See if this is the inverse side of a bidirectional relationship. // If so, then resolve the member and cache it in the context. // @@ -882,8 +896,9 @@ namespace relational } // @@ Would be good to check that the other end is actually - // an object pointer and is not marked as inverse. But the - // other class may not have been processed yet. + // an object pointer, is not marked as inverse, and points + // to the correct object. But the other class may not have + // been processed yet. // m.remove ("inverse"); m.set (kp + (kp.empty () ? "": "-") + "inverse", im); |