aboutsummaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-11-29 11:32:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-11-29 11:32:43 +0200
commitd5a8a14abbbdb41c753502ea25e2c327ada106f3 (patch)
tree056cc6170f61cf4a4b535f5cc975d872db8601f2 /odb
parentd5e7059d8741c3a402d76b14209531474421ffac (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.
Diffstat (limited to 'odb')
-rw-r--r--odb/callback.hxx3
-rw-r--r--odb/exception.hxx3
-rw-r--r--odb/exceptions.hxx3
-rw-r--r--odb/forward.hxx21
-rw-r--r--odb/lazy-ptr.hxx4
-rw-r--r--odb/nullable.hxx4
-rw-r--r--odb/prepared-query.hxx4
-rw-r--r--odb/result.hxx4
-rw-r--r--odb/schema-catalog.hxx4
9 files changed, 36 insertions, 14 deletions
diff --git a/odb/callback.hxx b/odb/callback.hxx
index 20326e4..6a836e3 100644
--- a/odb/callback.hxx
+++ b/odb/callback.hxx
@@ -7,6 +7,7 @@
#include <odb/pre.hxx>
+#include <odb/forward.hxx> // odb::core
#include <odb/details/export.hxx>
namespace odb
@@ -32,7 +33,7 @@ namespace odb
value v_;
};
- namespace core
+ namespace common
{
using odb::callback_event;
}
diff --git a/odb/exception.hxx b/odb/exception.hxx
index 004ed65..823d785 100644
--- a/odb/exception.hxx
+++ b/odb/exception.hxx
@@ -9,6 +9,7 @@
#include <exception>
+#include <odb/forward.hxx> // odb::core
#include <odb/details/export.hxx>
namespace odb
@@ -19,7 +20,7 @@ namespace odb
what () const throw () = 0;
};
- namespace core
+ namespace common
{
using odb::exception;
}
diff --git a/odb/exceptions.hxx b/odb/exceptions.hxx
index 90729fc..df14928 100644
--- a/odb/exceptions.hxx
+++ b/odb/exceptions.hxx
@@ -9,6 +9,7 @@
#include <string>
+#include <odb/forward.hxx> // odb::core
#include <odb/exception.hxx>
#include <odb/details/export.hxx>
@@ -188,7 +189,7 @@ namespace odb
std::string what_;
};
- namespace core
+ namespace common
{
using odb::null_pointer;
diff --git a/odb/forward.hxx b/odb/forward.hxx
index 705acd3..fe23c5f 100644
--- a/odb/forward.hxx
+++ b/odb/forward.hxx
@@ -14,6 +14,19 @@
namespace odb
{
+ // Common and core namespaces. The idea is that you can use the
+ // using directive to get database-independent (common) names or
+ // all core names (core).
+ //
+ namespace common {}
+
+ namespace core
+ {
+ using namespace common;
+ }
+
+ //
+ //
class database;
class connection;
typedef details::shared_ptr<connection> connection_ptr;
@@ -21,6 +34,11 @@ namespace odb
class statement;
class session;
+ namespace common
+ {
+ using odb::session;
+ }
+
namespace core
{
using odb::database;
@@ -28,7 +46,6 @@ namespace odb
using odb::connection_ptr;
using odb::transaction;
using odb::statement;
- using odb::session;
}
// Tracing.
@@ -36,7 +53,7 @@ namespace odb
class tracer; // Not in core.
extern LIBODB_EXPORT tracer& stderr_tracer;
- namespace core
+ namespace common
{
using odb::stderr_tracer;
}
diff --git a/odb/lazy-ptr.hxx b/odb/lazy-ptr.hxx
index 8df47b9..3de8dab 100644
--- a/odb/lazy-ptr.hxx
+++ b/odb/lazy-ptr.hxx
@@ -10,7 +10,7 @@
#include <memory> // std::auto_ptr, std::shared_ptr/weak_ptr
#include <utility> // std::move
-#include <odb/forward.hxx> // odb::database
+#include <odb/forward.hxx> // odb::core, odb::database
#include <odb/traits.hxx>
#include <odb/lazy-ptr-impl.hxx>
#include <odb/details/config.hxx> // ODB_CXX11
@@ -627,7 +627,7 @@ namespace odb
#endif // ODB_CXX11
- namespace core
+ namespace common
{
using odb::lazy_ptr;
using odb::lazy_auto_ptr;
diff --git a/odb/nullable.hxx b/odb/nullable.hxx
index e3c9bc8..565b4ee 100644
--- a/odb/nullable.hxx
+++ b/odb/nullable.hxx
@@ -7,6 +7,8 @@
#include <odb/pre.hxx>
+#include <odb/forward.hxx> // odb::core
+
namespace odb
{
template <typename T>
@@ -52,7 +54,7 @@ namespace odb
bool null_;
};
- namespace core
+ namespace common
{
using odb::nullable;
}
diff --git a/odb/prepared-query.hxx b/odb/prepared-query.hxx
index 53d8110..928f078 100644
--- a/odb/prepared-query.hxx
+++ b/odb/prepared-query.hxx
@@ -7,7 +7,7 @@
#include <odb/pre.hxx>
-#include <odb/forward.hxx>
+#include <odb/forward.hxx> // odb::core
#include <odb/traits.hxx>
#include <odb/result.hxx>
#include <odb/statement.hxx>
@@ -162,7 +162,7 @@ namespace odb
prepared_query_impl* impl_;
};
- namespace core
+ namespace common
{
using odb::prepared_query;
}
diff --git a/odb/result.hxx b/odb/result.hxx
index 5db08cd..d90ceb0 100644
--- a/odb/result.hxx
+++ b/odb/result.hxx
@@ -9,7 +9,7 @@
#include <cstddef> // std::ptrdiff_t, std::size_t
-#include <odb/forward.hxx>
+#include <odb/forward.hxx> // odb::core
#include <odb/traits.hxx>
#include <odb/details/export.hxx>
@@ -215,7 +215,7 @@ namespace odb
details::shared_ptr<result_impl_type> impl_;
};
- namespace core
+ namespace common
{
using odb::result;
using odb::result_iterator;
diff --git a/odb/schema-catalog.hxx b/odb/schema-catalog.hxx
index d79d0b3..861c3d0 100644
--- a/odb/schema-catalog.hxx
+++ b/odb/schema-catalog.hxx
@@ -9,7 +9,7 @@
#include <string>
-#include <odb/forward.hxx>
+#include <odb/forward.hxx> // odb::core
#include <odb/details/export.hxx>
@@ -22,7 +22,7 @@ namespace odb
create_schema (database&, const std::string& name = "");
};
- namespace core
+ namespace common
{
using odb::schema_catalog;
}