aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-02-18 10:42:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-02-18 10:42:41 +0200
commita9a87afc39f815024b1908473a3ed33a82ddd25e (patch)
treef823496c9506356fbb8d0adfdc4c416f16d934ba
parent391a4c294e9d9a378c636b7c25e6da027b60d45b (diff)
Add odb::core namespace to be used in using-directives
Port all the examples and tests.
-rw-r--r--NEWS20
-rw-r--r--doc/manual.xhtml19
2 files changed, 35 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 995762a..2e8ade1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Version 1.2.0
+
+ * New namespace, odb::core, contains using-declarations for the core ODB
+ constructs, such as the database, transaction, etc. The primary use of
+ this namespace is in the using-directives:
+
+ using namespace odb::core;
+
+ The above form should be preferred over the old variant:
+
+ using namespace odb;
+
+ The new approach brings all the essential ODB names into the current
+ namespace without any of the auxiliary objects such as traits, etc.,
+ which minimizes the likelihood of conflicts with other libraries.
+ Note that you can still use the odb namespace when qualifying
+ individual names, for example, odb::database.
+
Version 1.1.0
* Support for storing containers in the database. For more information refer
@@ -29,7 +47,7 @@ Version 1.1.0
profile library. See the ODB compiler command line manual for details.
* Support for literal names (template-id, derived type declarator such as
- pointers, etc) in data member declarations. Now, for example, you can use
+ pointers, etc) in data member declarations. Now, for example, you can use
std::vector<std::string> directly instead of having to create a typedef
alias for it.
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index 5b5e3d6..04a967f 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -1080,14 +1080,14 @@ mysql --user=odb_test --database=odb_test &lt; person.sql
#include "person-odb.hxx"
using namespace std;
-using namespace odb;
+using namespace odb::core;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr&lt;database> db (new mysql::database (argc, argv));
+ auto_ptr&lt;database> db (new odb::mysql::database (argc, argv));
unsigned long john_id, jane_id, joe_id;
@@ -1128,6 +1128,19 @@ main (int argc, char* argv[])
we include <code>person.hxx</code> and <code>person-odb.hxx</code>
which define our persistent <code>person</code> class.</p>
+ <p>Then we have two <code>using namespace</code> directives. The first
+ one brings in the names from the standard namespace and the second
+ brings in the ODB declarations which we will use later in the file.
+ Notice that in the second directive we use the <code>odb::core</code>
+ namespace instead of just <code>odb</code>. The former only brings
+ into the current namespace the essential ODB names, such as the
+ <code>database</code> and <code>transaction</code> classes, without
+ any of the auxiliary objects. This minimizes the likelihood of name
+ conflicts with other libraries. Note also that you should continue
+ using the <code>odb</code> namespace when qualifying individual names.
+ For example, you should write <code>odb::database</code>, not
+ <code>odb::core::database</code>.</p>
+
<p>Once we are in <code>main()</code>, the first thing we do is create
the MySQL database object. Notice that this is the last line in
<code>driver.cxx</code> that mentions MySQL explicitly; the rest
@@ -4823,7 +4836,7 @@ CREATE TABLE `person_nickname` (
#include &lt;odb/session.hxx>
#include &lt;odb/transaction.hxx>
-using namespace odb;
+using namespace odb::core;
{
session s;