From 95cb59ee9e7770bd38e14bc86069b7c4d80ea08e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Apr 2015 16:35:43 +0200 Subject: Set polymorphic_objects feature if we have polymorphic-object-based view We need the polymorphism-related includes in such a view's implementation. --- odb/validator.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/odb/validator.cxx b/odb/validator.cxx index e80f4d8..8afdeb3 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -1423,11 +1423,25 @@ namespace } virtual void - traverse_view (type&) + traverse_view (type& c) { // We don't check for the column count here since we may want to // allow certain kinds of empty views. Instead, this is handled // in relational::validation. + + // See if any of the associated objects are polymorphic. If so, + // we need to include polymorphism-specific headers. + // + if (c.count ("objects")) + { + view_objects& objs (c.get ("objects")); + + for (view_objects::iterator i (objs.begin ()); i != objs.end (); ++i) + { + if (i->kind == view_object::object && polymorphic (*i->obj)) + features.polymorphic_object = true; + } + } } virtual void -- cgit v1.1