From bfc6d29f8ef4efc48334cf0c25af433d85c21ed6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Nov 2012 11:32:44 +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/sqlite/connection.hxx | 1 - odb/sqlite/exceptions.hxx | 7 +++++++ odb/sqlite/forward.hxx | 16 ++++++++++++++++ odb/sqlite/query.hxx | 5 +++++ odb/sqlite/statement.hxx | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 2754102..6dd8292 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -9,7 +9,6 @@ #include -#include #include #include diff --git a/odb/sqlite/exceptions.hxx b/odb/sqlite/exceptions.hxx index 52a976f..a38237c 100644 --- a/odb/sqlite/exceptions.hxx +++ b/odb/sqlite/exceptions.hxx @@ -12,6 +12,7 @@ #include #include +#include #include namespace odb @@ -65,6 +66,12 @@ namespace odb private: std::string what_; }; + + namespace core + { + using sqlite::database_exception; + using sqlite::cli_exception; + } } } diff --git a/odb/sqlite/forward.hxx b/odb/sqlite/forward.hxx index e2f4df1..382284e 100644 --- a/odb/sqlite/forward.hxx +++ b/odb/sqlite/forward.hxx @@ -13,6 +13,13 @@ namespace odb { namespace sqlite { + 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 sqlite::database; + using sqlite::connection; + using sqlite::connection_ptr; + using sqlite::transaction; + using sqlite::statement; + } + // Implementation details. // enum statement_kind diff --git a/odb/sqlite/query.hxx b/odb/sqlite/query.hxx index 18c10bb..0f7657c 100644 --- a/odb/sqlite/query.hxx +++ b/odb/sqlite/query.hxx @@ -1395,6 +1395,11 @@ namespace odb { } }; + + namespace core + { + using sqlite::query; + } } // Derive odb::query from odb::sqlite::query so that it can be diff --git a/odb/sqlite/statement.hxx b/odb/sqlite/statement.hxx index aabb57d..fe3a2a0 100644 --- a/odb/sqlite/statement.hxx +++ b/odb/sqlite/statement.hxx @@ -14,10 +14,10 @@ #include // std::strlen, std::memcpy #include -#include #include #include +#include #include #include #include -- cgit v1.1