From b9fe963646367f2da21ba1053bc086bd17b09967 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 24 Apr 2011 11:27:14 +0200 Subject: Implement id_type value type pragma --- odb/relational/type-processor.cxx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'odb/relational/type-processor.cxx') diff --git a/odb/relational/type-processor.cxx b/odb/relational/type-processor.cxx index 97f4d85..511ac9e 100644 --- a/odb/relational/type-processor.cxx +++ b/odb/relational/type-processor.cxx @@ -31,7 +31,7 @@ namespace relational { context& c (context::current ()); semantics::data_member& id (context::id_member (*c.object)); - return id.get ("ref-column-type"); + return id.get ("column-type"); } struct data_member: traversal::data_member, context @@ -113,9 +113,6 @@ namespace relational if (m.count ("type")) type = m.get ("type"); - if (type.empty () && t.count ("type")) - type = t.get ("type"); - if (semantics::class_* c = process_object_pointer (m, t)) { // This is an object pointer. The column type is the pointed-to @@ -127,6 +124,9 @@ namespace relational if (type.empty () && id.count ("type")) type = id.get ("type"); + if (type.empty () && idt.count ("id-type")) + type = idt.get ("id-type"); + if (type.empty () && idt.count ("type")) type = idt.get ("type"); @@ -139,20 +139,18 @@ namespace relational } else { - string orig (type); - type = database_type (t, orig, m, ctf_none); + if (type.empty () && m.count ("id") && t.count ("id-type")) + type = t.get ("id-type"); + + if (type.empty () && t.count ("type")) + type = t.get ("type"); - if (m.count ("id")) - ref_type = database_type (t, orig, m, ctf_none); + type = database_type (t, type, m, ctf_none); } if (!type.empty ()) { m.set ("column-type", type); - - if (!ref_type.empty ()) - m.set ("ref-column-type", ref_type); - return; } @@ -199,9 +197,6 @@ namespace relational if (type.empty () && ct.count (prefix + "-type")) type = ct.get (prefix + "-type"); - if (type.empty () && t.count ("type")) - type = t.get ("type"); - semantics::class_* c; if (obj_ptr && (c = process_object_pointer (m, t, prefix))) { @@ -214,6 +209,9 @@ namespace relational if (type.empty () && id.count ("type")) type = id.get ("type"); + if (type.empty () && idt.count ("id-type")) + type = idt.get ("id-type"); + if (type.empty () && idt.count ("type")) type = idt.get ("type"); @@ -225,7 +223,12 @@ namespace relational type = database_type (idt, type, id, f); } else + { + if (type.empty () && t.count ("type")) + type = t.get ("type"); + type = database_type (t, type, m, ctf_none); + } if (!type.empty ()) { -- cgit v1.1