aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/header.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-11-07 09:48:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-11-21 13:13:50 +0200
commitd01c8e22abea35477f21488613f2474a2e4e8fc7 (patch)
tree9d08d4dfbfbe4535f5cf2829c01fe81d4d7668ea /odb/relational/header.cxx
parentcc3979f34a886ae4c89d4e3e86a5b0db1669585f (diff)
Generate query tags in object_traits for dynamic multi-database support
Diffstat (limited to 'odb/relational/header.cxx')
-rw-r--r--odb/relational/header.cxx41
1 files changed, 11 insertions, 30 deletions
diff --git a/odb/relational/header.cxx b/odb/relational/header.cxx
index 3c9cd5a..099dc33 100644
--- a/odb/relational/header.cxx
+++ b/odb/relational/header.cxx
@@ -152,13 +152,14 @@ traverse_object (type& c)
if (options.generate_query ())
{
- // Generate object pointer tags.
+ // Generate object pointer tags here unless we are generating dynamic
+ // multi-database support, in which case they generated in object_traits.
//
- if (has_a (c, test_pointer | exclude_base))
+ if (options.multi_database () != multi_database::dynamic &&
+ has_a (c, test_pointer | exclude_base))
{
- instance<query_tags> t;
- t->traverse (c);
- os << endl;
+ query_tags t; // Not customizable.
+ t.traverse (c);
}
}
@@ -673,33 +674,13 @@ traverse_view (type& c)
// Query.
//
- // Generate associated object tags.
+ // Generate associated object tags here unless we are generating dynamic
+ // multi-database support, in which case they generated in object_traits.
//
- if (obj_count != 0)
+ if (options.multi_database () != multi_database::dynamic)
{
- 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_tags t; // Not customizable.
+ t.traverse (c);
}
// query_base_type and query_columns (definition generated by class2).