diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-11-21 13:11:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-11-21 13:13:50 +0200 |
commit | 9ad0acf37561de9bf359a561faed53de17c2ca3b (patch) | |
tree | 4b38b866a4917992a6e22cde9f22539e08d4ed9e /odb/generator.cxx | |
parent | d01c8e22abea35477f21488613f2474a2e4e8fc7 (diff) |
Add dynamic multi-database query support
Diffstat (limited to 'odb/generator.cxx')
-rw-r--r-- | odb/generator.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
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. |