aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-11-29 11:32:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-11-29 11:32:44 +0200
commitbfe99354380c4a3a77a181cd8abaacab09a45fb5 (patch)
treef61e573df9a84fa8a0bec53a0a92d110bab82526
parent9ccd928f7b3d36b7be4a8dc8d180a441c9bf55e1 (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/mysql/connection.hxx1
-rw-r--r--odb/mysql/exceptions.hxx7
-rw-r--r--odb/mysql/forward.hxx16
-rw-r--r--odb/mysql/query.hxx5
-rw-r--r--odb/mysql/statement.hxx2
5 files changed, 29 insertions, 2 deletions
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx
index e729407..8316386 100644
--- a/odb/mysql/connection.hxx
+++ b/odb/mysql/connection.hxx
@@ -9,7 +9,6 @@
#include <vector>
-#include <odb/forward.hxx>
#include <odb/connection.hxx>
#include <odb/mysql/mysql.hxx>
diff --git a/odb/mysql/exceptions.hxx b/odb/mysql/exceptions.hxx
index 35f4e90..a78a1a8 100644
--- a/odb/mysql/exceptions.hxx
+++ b/odb/mysql/exceptions.hxx
@@ -12,6 +12,7 @@
#include <odb/exceptions.hxx>
#include <odb/mysql/version.hxx>
+#include <odb/mysql/forward.hxx>
#include <odb/mysql/details/export.hxx>
@@ -66,6 +67,12 @@ namespace odb
private:
std::string what_;
};
+
+ namespace core
+ {
+ using mysql::database_exception;
+ using mysql::cli_exception;
+ }
}
}
diff --git a/odb/mysql/forward.hxx b/odb/mysql/forward.hxx
index 7530329..806ee62 100644
--- a/odb/mysql/forward.hxx
+++ b/odb/mysql/forward.hxx
@@ -13,6 +13,13 @@ namespace odb
{
namespace mysql
{
+ 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 mysql::database;
+ using mysql::connection;
+ using mysql::connection_ptr;
+ using mysql::transaction;
+ using mysql::statement;
+ }
+
// Implementation details.
//
enum statement_kind
diff --git a/odb/mysql/query.hxx b/odb/mysql/query.hxx
index 2a02b95..b86818e 100644
--- a/odb/mysql/query.hxx
+++ b/odb/mysql/query.hxx
@@ -1965,6 +1965,11 @@ namespace odb
{
}
};
+
+ namespace core
+ {
+ using mysql::query;
+ }
}
// Derive odb::query from odb::mysql::query so that it can be
diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx
index 66717aa..b4e28a5 100644
--- a/odb/mysql/statement.hxx
+++ b/odb/mysql/statement.hxx
@@ -10,11 +10,11 @@
#include <string>
#include <cstddef> // std::size_t
-#include <odb/forward.hxx>
#include <odb/statement.hxx>
#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
+#include <odb/mysql/forward.hxx>
#include <odb/mysql/binding.hxx>
#include <odb/mysql/connection.hxx>
#include <odb/mysql/auto-handle.hxx>