From 9f0b648c14bbb6dbb1a36c9bd4d88c5773c72ca0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Nov 2012 11:32:43 +0200 Subject: Namespace management for static multi-database support Now in libodb the odb::core namespace is split into odb::common (database- independent stuff) and odb::core proper, which imports odb::common. Each database runtime now defines odb::::core namespace which also imports odb::common and adds the database-specific bits. The overall idea is that one can do using namespace odb::::core just like for odb::core. --- odb/mssql/connection.hxx | 3 +-- odb/mssql/exceptions.hxx | 10 +++++++++- odb/mssql/forward.hxx | 16 ++++++++++++++++ odb/mssql/query.hxx | 5 +++++ odb/mssql/statement.hxx | 4 ++-- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/odb/mssql/connection.hxx b/odb/mssql/connection.hxx index 0451f9b..a1b4541 100644 --- a/odb/mssql/connection.hxx +++ b/odb/mssql/connection.hxx @@ -7,16 +7,15 @@ #include -#include #include #include #include #include -#include #include #include +#include #include #include #include diff --git a/odb/mssql/exceptions.hxx b/odb/mssql/exceptions.hxx index 1f13948..8e01f4f 100644 --- a/odb/mssql/exceptions.hxx +++ b/odb/mssql/exceptions.hxx @@ -12,8 +12,9 @@ #include -#include #include +#include +#include #include namespace odb @@ -113,6 +114,13 @@ namespace odb virtual const char* what () const throw (); }; + + namespace core + { + using mssql::database_exception; + using mssql::cli_exception; + using mssql::long_data_reload; + } } } diff --git a/odb/mssql/forward.hxx b/odb/mssql/forward.hxx index 2a91c62..2bb21e3 100644 --- a/odb/mssql/forward.hxx +++ b/odb/mssql/forward.hxx @@ -13,6 +13,13 @@ namespace odb { namespace mssql { + namespace core + { + using namespace odb::common; + } + + // + // class database; class connection; typedef details::shared_ptr connection_ptr; @@ -21,6 +28,15 @@ namespace odb class transaction; class tracer; + namespace core + { + using mssql::database; + using mssql::connection; + using mssql::connection_ptr; + using mssql::transaction; + using mssql::statement; + } + // Implementation details. // enum statement_kind diff --git a/odb/mssql/query.hxx b/odb/mssql/query.hxx index 356ed58..d9a84e4 100644 --- a/odb/mssql/query.hxx +++ b/odb/mssql/query.hxx @@ -2376,6 +2376,11 @@ namespace odb { } }; + + namespace core + { + using mssql::query; + } } // Derive odb::query from odb::mssql::query so that it can be diff --git a/odb/mssql/statement.hxx b/odb/mssql/statement.hxx index 53e7c97..4b54097 100644 --- a/odb/mssql/statement.hxx +++ b/odb/mssql/statement.hxx @@ -10,11 +10,11 @@ #include #include // std::size_t -#include #include -#include #include +#include +#include #include #include #include -- cgit v1.1