From 475a7c89e1c858ae8fec466670af4628129a42d4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 28 Aug 2011 11:39:17 +0200 Subject: Add wrapper support for containers --- odb/relational/sqlite/common.cxx | 11 ++++++----- odb/relational/sqlite/common.hxx | 9 ++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'odb/relational/sqlite') diff --git a/odb/relational/sqlite/common.cxx b/odb/relational/sqlite/common.cxx index d9f79b0..1531e75 100644 --- a/odb/relational/sqlite/common.cxx +++ b/odb/relational/sqlite/common.cxx @@ -35,22 +35,23 @@ namespace relational semantics::type& t (type_override_ != 0 ? *type_override_ : m.type ()); - if (semantics::class_* comp = comp_value_wrapper (t)) + if (semantics::class_* c = comp_value_wrapper (t)) { // If t is a wrapper, pass the wrapped type. Also pass the // original, wrapper type. // - member_info mi ( - m, *comp, (wrapper (t) ? &t : 0), var, fq_type_override_); + member_info mi (m, *c, (wrapper (t) ? &t : 0), var, fq_type_override_); if (pre (mi)) { traverse_composite (mi); post (mi); } } - else if (container (t)) + else if (semantics::type* c = container_wrapper (t)) { - member_info mi (m, t, 0, var, fq_type_override_); + // The same unwrapping logic as for composite values. + // + member_info mi (m, *c, (wrapper (t) ? &t : 0), var, fq_type_override_); if (pre (mi)) { traverse_container (mi); diff --git a/odb/relational/sqlite/common.hxx b/odb/relational/sqlite/common.hxx index e3f81a5..e8663af 100644 --- a/odb/relational/sqlite/common.hxx +++ b/odb/relational/sqlite/common.hxx @@ -40,10 +40,13 @@ namespace relational string fq_type (bool unwrap = true) const { - // At the moment a wrapped type can only be a composite value. - // if (wrapper != 0 && unwrap) - return t.fq_name (); + { + // Use the hint from the wrapper. + // + return t.fq_name ( + wrapper->get ("wrapper-hint")); + } // Use the original type from 'm' instead of 't' since the hint // may be invalid for a different type. Plus, if a type is -- cgit v1.1