diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-11-29 11:32:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-11-29 11:32:44 +0200 |
commit | bfc6d29f8ef4efc48334cf0c25af433d85c21ed6 (patch) | |
tree | bf4c606068b36d53154cbbaa470e77864a2aebb0 | |
parent | a2914e837c6442db936fd035b49f60ee488df533 (diff) |
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::<db>::core namespace which also imports
odb::common and adds the database-specific bits. The overall idea is that
one can do using namespace odb::<db>::core just like for odb::core.
-rw-r--r-- | odb/sqlite/connection.hxx | 1 | ||||
-rw-r--r-- | odb/sqlite/exceptions.hxx | 7 | ||||
-rw-r--r-- | odb/sqlite/forward.hxx | 16 | ||||
-rw-r--r-- | odb/sqlite/query.hxx | 5 | ||||
-rw-r--r-- | 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 <sqlite3.h> -#include <odb/forward.hxx> #include <odb/connection.hxx> #include <odb/details/mutex.hxx> 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 <odb/exceptions.hxx> #include <odb/sqlite/version.hxx> +#include <odb/sqlite/forward.hxx> #include <odb/sqlite/details/export.hxx> 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> 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 <cstring> // std::strlen, std::memcpy #include <cassert> -#include <odb/forward.hxx> #include <odb/statement.hxx> #include <odb/sqlite/version.hxx> +#include <odb/sqlite/forward.hxx> #include <odb/sqlite/binding.hxx> #include <odb/sqlite/connection.hxx> #include <odb/sqlite/auto-handle.hxx> |