From 9ad0acf37561de9bf359a561faed53de17c2ca3b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Nov 2012 13:11:43 +0200 Subject: Add dynamic multi-database query support --- odb/generator.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'odb/generator.cxx') diff --git a/odb/generator.cxx b/odb/generator.cxx index 4fa4cf2..279017e 100644 --- a/odb/generator.cxx +++ b/odb/generator.cxx @@ -513,8 +513,23 @@ generate (options const& ops, } } - cxx << "#include " << ctx->process_include_path (hxx_name) << endl - << endl; + // Include query columns implementations for explicit instantiations. + // + string impl_guard; + if (md == multi_database::dynamic) + { + impl_guard = ctx->make_guard ( + "ODB_" + db.string () + "_QUERY_COLUMNS_DEF"); + + cxx << "#define " << impl_guard << endl; + } + + cxx << "#include " << ctx->process_include_path (hxx_name) << endl; + + if (!impl_guard.empty ()) + cxx << "#undef " << impl_guard << endl; + + cxx << endl; { // We don't want to indent prologues/epilogues. -- cgit v1.1