diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-27 11:36:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-27 11:36:43 +0200 |
commit | 15b1a95942518c84f8161c59820ea5d0e49a4e54 (patch) | |
tree | 0a2f6e60622c6085dba00d21e094944526f97d33 /odb/relational/source.hxx | |
parent | 7e22a444bc360d1b74a25c6d508daea86ca8d5d2 (diff) |
Add support for NULL pointers to objects with composite object ids
Diffstat (limited to 'odb/relational/source.hxx')
-rw-r--r-- | odb/relational/source.hxx | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index bbea0a7..594274a 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -1266,10 +1266,10 @@ namespace relational os << "}" << "else" << endl; - // @@ Composite value currently cannot be NULL. - // - if (!null (mi.m, key_prefix_) || composite (mi.t)) + if (!null (mi.m, key_prefix_)) os << "throw null_pointer ();"; + else if (composite (mi.t)) + os << traits << "::set_null (i." << mi.var << "value, sk);"; else set_null (mi); } @@ -1456,22 +1456,23 @@ namespace relational " > ptr_traits;" << endl; - // @@ Composite value currently cannot be NULL. - // - if (!comp) - { - os << "if ("; + os << "if ("; + + if (comp) + os << "composite_value_traits< " + type + " >::get_null (i." << + mi.var << "value)"; + else get_null (mi); - os << ")" << endl; - if (!null (mi.m, key_prefix_) ) - os << "throw null_pointer ();"; - else - os << member << " = ptr_traits::pointer_type ();"; + os << ")" << endl; - os << "else" - << "{"; - } + if (!null (mi.m, key_prefix_) ) + os << "throw null_pointer ();"; + else + os << member << " = ptr_traits::pointer_type ();"; + + os << "else" + << "{"; os << type << " id;"; @@ -1542,12 +1543,8 @@ namespace relational } } - // @@ Composite value currently cannot be NULL. - // - if (!composite (mi.t)) - os << "}"; - - os << "}"; + os << "}" + << "}"; } } |