diff options
Diffstat (limited to 'odb/relational/pgsql/source.cxx')
-rw-r--r-- | odb/relational/pgsql/source.cxx | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx index bfc26ba..1bba68a 100644 --- a/odb/relational/pgsql/source.cxx +++ b/odb/relational/pgsql/source.cxx @@ -420,6 +420,18 @@ namespace relational << "//" << endl; } + // If this is a wrapped composite value, then we need to + // "unwrap" it. For simple values this is taken care of + // by the value_traits specializations. + // + if (mi.wrapper != 0 && comp_value (mi.t)) + { + // Here we need the wrapper type, not the wrapped type. + // + member = "wrapper_traits< " + mi.fq_type (false) + " >::" + + "get_ref (" + member + ")"; + } + if (comp_value (mi.t)) traits = "composite_value_traits< " + mi.fq_type () + " >"; else @@ -515,8 +527,9 @@ namespace relational virtual void traverse_composite (member_info& mi) { - os << "if (" << traits << "::init (i." << mi.var << "value, " << - member << "))" + os << "if (" << traits << "::init (" << endl + << "i." << mi.var << "value," << endl + << member << "))" << "{" << "grew = true;" << "}"; @@ -650,6 +663,18 @@ namespace relational << "//" << endl; } + // If this is a wrapped composite value, then we need to + // "unwrap" it. For simple values this is taken care of + // by the value_traits specializations. + // + if (mi.wrapper != 0 && comp_value (mi.t)) + { + // Here we need the wrapper type, not the wrapped type. + // + member = "wrapper_traits< " + mi.fq_type (false) + " >::" + + "set_ref (" + member + ")"; + } + if (comp_value (mi.t)) traits = "composite_value_traits< " + mi.fq_type () + " >"; else @@ -734,8 +759,10 @@ namespace relational virtual void traverse_composite (member_info& mi) { - os << traits << "::init (" << member << ", i." << - mi.var << "value, db);" + os << traits << "::init (" << endl + << member << "," << endl + << "i." << mi.var << "value," << endl + << "db);" << endl; } @@ -1065,7 +1092,8 @@ namespace relational case ck_map: case ck_multimap: { - if (semantics::class_* ktc = comp_value (container_kt (mt))) + if (semantics::class_* ktc = + comp_value_wrapper (container_kt (mt))) { instance<statement_oids> st; st->traverse_composite (m, *ktc, "key", "key"); @@ -1083,7 +1111,7 @@ namespace relational } } - if (semantics::class_* vtc = comp_value (vt)) + if (semantics::class_* vtc = comp_value_wrapper (vt)) { instance <statement_oids> st; st->traverse_composite (m, *vtc, "value", "value"); |