diff options
Diffstat (limited to 'odb/relational/header.cxx')
-rw-r--r-- | odb/relational/header.cxx | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/odb/relational/header.cxx b/odb/relational/header.cxx index 1295106..3c9cd5a 100644 --- a/odb/relational/header.cxx +++ b/odb/relational/header.cxx @@ -147,6 +147,22 @@ traverse_object (type& c) } // + // Query (abstract and concrete). + // + + if (options.generate_query ()) + { + // Generate object pointer tags. + // + if (has_a (c, test_pointer | exclude_base)) + { + instance<query_tags> t; + t->traverse (c); + os << endl; + } + } + + // // Functions (abstract and concrete). // @@ -630,6 +646,7 @@ void relational::header::class1:: traverse_view (type& c) { string const& type (class_fq_name (c)); + size_t obj_count (c.get<size_t> ("object-count")); os << "// " << class_name (c) << endl << "//" << endl; @@ -656,12 +673,41 @@ traverse_view (type& c) // Query. // + // Generate associated object tags. + // + if (obj_count != 0) + { + view_objects& objs (c.get<view_objects> ("objects")); + + { + instance<query_tags> t; + + bool gen (false); + for (view_objects::const_iterator i (objs.begin ()); + i < objs.end (); + ++i) + { + if (i->kind != view_object::object) + continue; // Skip tables. + + if (i->alias.empty ()) + continue; + + t->generate (i->alias); + gen = true; + } + + if (gen) + os << endl; + } + } + // query_base_type and query_columns (definition generated by class2). // os << "typedef " << db << "::query_base query_base_type;" << "struct query_columns"; - if (c.get<size_t> ("object-count") == 0) + if (obj_count == 0) os << "{" << "};"; else |