aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:08 +0200
commit3d1969a43fce72dd50044c5eada38557f3f200bd (patch)
tree8515c6a535117d4f53bc8fe59feab8129563ebb4
parent6b76715e63d2c265a4c51c73f9019bc578f874cb (diff)
Ground work for multi-database support
All generated code now includes database id. The database-specific database class interface has been updated to include all the database operations. The database-specific tests now use this interface.
-rw-r--r--common/readonly/driver.cxx6
-rw-r--r--libcommon/common/common.hxx12
-rw-r--r--mssql/custom/driver.cxx7
-rw-r--r--mssql/custom/query.hxx34
-rw-r--r--mssql/database/driver.cxx3
-rw-r--r--mssql/native/driver.cxx5
-rw-r--r--mssql/query/driver.cxx7
-rw-r--r--mssql/template/driver.cxx5
-rw-r--r--mssql/types/driver.cxx7
-rw-r--r--mysql/custom/driver.cxx7
-rw-r--r--mysql/custom/query.hxx34
-rw-r--r--mysql/database/driver.cxx3
-rw-r--r--mysql/index/driver.cxx5
-rw-r--r--mysql/native/driver.cxx5
-rw-r--r--mysql/template/driver.cxx5
-rw-r--r--mysql/truncation/driver.cxx11
-rw-r--r--mysql/types/driver.cxx5
-rw-r--r--oracle/custom/driver.cxx5
-rw-r--r--oracle/database/driver.cxx3
-rw-r--r--oracle/native/driver.cxx5
-rw-r--r--oracle/template/driver.cxx5
-rw-r--r--oracle/types/driver.cxx9
-rw-r--r--pgsql/custom/driver.cxx7
-rw-r--r--pgsql/custom/query.hxx34
-rw-r--r--pgsql/database/driver.cxx3
-rw-r--r--pgsql/index/driver.cxx7
-rw-r--r--pgsql/native/driver.cxx6
-rw-r--r--pgsql/template/driver.cxx5
-rw-r--r--pgsql/truncation/driver.cxx9
-rw-r--r--pgsql/types/driver.cxx5
-rw-r--r--sqlite/custom/driver.cxx5
-rw-r--r--sqlite/database/driver.cxx3
-rw-r--r--sqlite/native/driver.cxx6
-rw-r--r--sqlite/template/driver.cxx5
-rw-r--r--sqlite/truncation/driver.cxx11
-rw-r--r--sqlite/types/driver.cxx8
36 files changed, 173 insertions, 129 deletions
diff --git a/common/readonly/driver.cxx b/common/readonly/driver.cxx
index b67ed4f..2e692cf 100644
--- a/common/readonly/driver.cxx
+++ b/common/readonly/driver.cxx
@@ -204,9 +204,9 @@ main (int argc, char* argv[])
// Readonly object.
//
{
- typedef odb::object_traits<simple_object> so_traits;
- typedef odb::object_traits<ro_object> ro_traits;
- typedef odb::object_traits<rw_object> rw_traits;
+ typedef odb::object_traits_impl<simple_object, odb::id_default> so_traits;
+ typedef odb::object_traits_impl<ro_object, odb::id_default> ro_traits;
+ typedef odb::object_traits_impl<rw_object, odb::id_default> rw_traits;
assert (so_traits::column_count ==
so_traits::id_column_count + so_traits::readonly_column_count);
diff --git a/libcommon/common/common.hxx b/libcommon/common/common.hxx
index 8ff02d3..2b79a5a 100644
--- a/libcommon/common/common.hxx
+++ b/libcommon/common/common.hxx
@@ -25,6 +25,18 @@ create_database (int& argc,
bool create_schema = true,
std::size_t max_connections = 0);
+template <typename T>
+std::auto_ptr<T>
+create_specific_database (int& argc,
+ char* argv[],
+ bool create_schema = true,
+ std::size_t max_connections = 0)
+{
+ std::auto_ptr<odb::database> r (
+ create_database (argc, argv, create_schema, max_connections));
+ return std::auto_ptr<T> (&dynamic_cast<T&> (*r.release ()));
+}
+
// This function returns an accurate result only if the result iterator
// hasn't been advanced.
//
diff --git a/mssql/custom/driver.cxx b/mssql/custom/driver.cxx
index 7b0891d..3e69f97 100644
--- a/mssql/custom/driver.cxx
+++ b/mssql/custom/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
@@ -58,7 +59,7 @@ main (int argc, char* argv[])
// Query.
//
- typedef odb::query<object> query;
+ typedef mssql::query<object> query;
typedef odb::result<object> result;
{
diff --git a/mssql/custom/query.hxx b/mssql/custom/query.hxx
index 21dee89..0c5f1f2 100644
--- a/mssql/custom/query.hxx
+++ b/mssql/custom/query.hxx
@@ -38,18 +38,18 @@ namespace odb
// is_null, is_not_null
//
public:
- query
+ query_base
is_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NULL";
return q;
}
- query
+ query_base
is_not_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NOT NULL";
return q;
}
@@ -57,63 +57,63 @@ namespace odb
// =
//
public:
- query
+ query_base
equal (const point& v) const
{
return equal (val_bind<point> (v));
}
- query
+ query_base
equal (val_bind<point> v) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += ".STEquals(";
q.append<point, id_string> (v, conversion_);
q += ") = 1";
return q;
}
- query
+ query_base
equal (ref_bind<point> r) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += ".STEquals(";
q.append<point, id_string> (r, conversion_);
q += ") = 1";
return q;
}
- friend query
+ friend query_base
operator== (const query_column& c, const point& v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const point& v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, val_bind<point> v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (val_bind<point> v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, ref_bind<point> r)
{
return c.equal (r);
}
- friend query
+ friend query_base
operator== (ref_bind<point> r, const query_column& c)
{
return c.equal (r);
@@ -122,10 +122,10 @@ namespace odb
// Column comparison.
//
public:
- query
+ query_base
operator== (const query_column<point, id_string>& c) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += ".STEquals(";
q.append (c.table (), c.column ());
q += ") = 1";
diff --git a/mssql/database/driver.cxx b/mssql/database/driver.cxx
index 747fc98..7f8aa8f 100644
--- a/mssql/database/driver.cxx
+++ b/mssql/database/driver.cxx
@@ -7,7 +7,8 @@
#include <odb/mssql/database.hxx>
-using namespace odb::mssql;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
diff --git a/mssql/native/driver.cxx b/mssql/native/driver.cxx
index 097a72d..710c3c5 100644
--- a/mssql/native/driver.cxx
+++ b/mssql/native/driver.cxx
@@ -15,14 +15,15 @@
#include <common/common.hxx>
using namespace std;
-using namespace odb::core;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Create the database schema.
//
diff --git a/mssql/query/driver.cxx b/mssql/query/driver.cxx
index 03e97af..03b3284 100644
--- a/mssql/query/driver.cxx
+++ b/mssql/query/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
{
object o1;
@@ -63,7 +64,7 @@ main (int argc, char* argv[])
t.commit ();
}
- typedef odb::query<object> query;
+ typedef mssql::query<object> query;
typedef odb::result<object> result;
{
diff --git a/mssql/template/driver.cxx b/mssql/template/driver.cxx
index 4c7ff97..26488fc 100644
--- a/mssql/template/driver.cxx
+++ b/mssql/template/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
//
//
diff --git a/mssql/types/driver.cxx b/mssql/types/driver.cxx
index cd5523d..6390950 100644
--- a/mssql/types/driver.cxx
+++ b/mssql/types/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mssql = odb::mssql;
+using namespace mssql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
{
object o (1);
@@ -130,7 +131,7 @@ main (int argc, char* argv[])
// Test short/long data in queries.
//
- typedef odb::query<object> query;
+ typedef mssql::query<object> query;
typedef odb::result<object> result;
{
diff --git a/mysql/custom/driver.cxx b/mysql/custom/driver.cxx
index b591095..83aac7e 100644
--- a/mysql/custom/driver.cxx
+++ b/mysql/custom/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
o.p = point (1.1111, 2222222222.2);
@@ -53,7 +54,7 @@ main (int argc, char* argv[])
// Query.
//
- typedef odb::query<object> query;
+ typedef mysql::query<object> query;
typedef odb::result<object> result;
{
diff --git a/mysql/custom/query.hxx b/mysql/custom/query.hxx
index 110624a..ccd00e7 100644
--- a/mysql/custom/query.hxx
+++ b/mysql/custom/query.hxx
@@ -35,18 +35,18 @@ namespace odb
// is_null, is_not_null
//
public:
- query
+ query_base
is_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NULL";
return q;
}
- query
+ query_base
is_not_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NOT NULL";
return q;
}
@@ -54,61 +54,61 @@ namespace odb
// =
//
public:
- query
+ query_base
equal (const point& v) const
{
return equal (val_bind<point> (v));
}
- query
+ query_base
equal (val_bind<point> v) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "=";
q.append<point, id_string> (v, conversion_);
return q;
}
- query
+ query_base
equal (ref_bind<point> r) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "=";
q.append<point, id_string> (r, conversion_);
return q;
}
- friend query
+ friend query_base
operator== (const query_column& c, const point& v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const point& v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, val_bind<point> v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (val_bind<point> v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, ref_bind<point> r)
{
return c.equal (r);
}
- friend query
+ friend query_base
operator== (ref_bind<point> r, const query_column& c)
{
return c.equal (r);
@@ -117,10 +117,10 @@ namespace odb
// Column comparison.
//
public:
- query
+ query_base
operator== (const query_column<point, id_string>& c) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "=";
q.append (c.table (), c.column ());
return q;
diff --git a/mysql/database/driver.cxx b/mysql/database/driver.cxx
index e9b625d..f385b3f 100644
--- a/mysql/database/driver.cxx
+++ b/mysql/database/driver.cxx
@@ -10,7 +10,8 @@
#include <odb/mysql/database.hxx>
using std::string;
-using namespace odb::mysql;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
diff --git a/mysql/index/driver.cxx b/mysql/index/driver.cxx
index b1e8e54..3b1a1af 100644
--- a/mysql/index/driver.cxx
+++ b/mysql/index/driver.cxx
@@ -18,7 +18,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
@@ -27,7 +28,7 @@ main (int argc, char* argv[])
{
// This is just a schema creation test.
//
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
{
transaction t (db->begin ());
diff --git a/mysql/native/driver.cxx b/mysql/native/driver.cxx
index a8d2f5f..9eaf504 100644
--- a/mysql/native/driver.cxx
+++ b/mysql/native/driver.cxx
@@ -15,14 +15,15 @@
#include <common/common.hxx>
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Create the database schema.
//
diff --git a/mysql/template/driver.cxx b/mysql/template/driver.cxx
index 636af43..0789891 100644
--- a/mysql/template/driver.cxx
+++ b/mysql/template/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
//
//
diff --git a/mysql/truncation/driver.cxx b/mysql/truncation/driver.cxx
index 43f18b3..da870d0 100644
--- a/mysql/truncation/driver.cxx
+++ b/mysql/truncation/driver.cxx
@@ -19,7 +19,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
@@ -34,7 +35,7 @@ main (int argc, char* argv[])
// Test basic operations.
//
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Run persist/load so that the initial bindings are established
// (version == 0).
@@ -99,10 +100,10 @@ main (int argc, char* argv[])
// Test query.
//
{
- typedef odb::query<object1> query;
+ typedef mysql::query<object1> query;
typedef odb::result<object1> result;
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Run persist/query so that the initial bindings are established
// (version == 0).
@@ -157,7 +158,7 @@ main (int argc, char* argv[])
// Test containers.
//
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Use different connections to persist and load the object.
//
diff --git a/mysql/types/driver.cxx b/mysql/types/driver.cxx
index 493c5c2..d2f159c 100644
--- a/mysql/types/driver.cxx
+++ b/mysql/types/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace mysql = odb::mysql;
+using namespace mysql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
diff --git a/oracle/custom/driver.cxx b/oracle/custom/driver.cxx
index 2425b29..16b81da 100644
--- a/oracle/custom/driver.cxx
+++ b/oracle/custom/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace oracle = odb::oracle;
+using namespace oracle;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
o.iv.push_back (123);
diff --git a/oracle/database/driver.cxx b/oracle/database/driver.cxx
index d6846b6..53dda69 100644
--- a/oracle/database/driver.cxx
+++ b/oracle/database/driver.cxx
@@ -7,7 +7,8 @@
#include <odb/oracle/database.hxx>
-using namespace odb::oracle;
+namespace oracle = odb::oracle;
+using namespace oracle;
int
main (int argc, char* argv[])
diff --git a/oracle/native/driver.cxx b/oracle/native/driver.cxx
index 0e90ff0..9530692 100644
--- a/oracle/native/driver.cxx
+++ b/oracle/native/driver.cxx
@@ -15,14 +15,15 @@
#include <common/common.hxx>
using namespace std;
-using namespace odb::core;
+namespace oracle = odb::oracle;
+using namespace oracle;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Create the database schema.
//
diff --git a/oracle/template/driver.cxx b/oracle/template/driver.cxx
index 44b4f83..35a2b39 100644
--- a/oracle/template/driver.cxx
+++ b/oracle/template/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace oracle = odb::oracle;
+using namespace oracle;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
//
//
diff --git a/oracle/types/driver.cxx b/oracle/types/driver.cxx
index 7c3e6bd..be6251c 100644
--- a/oracle/types/driver.cxx
+++ b/oracle/types/driver.cxx
@@ -18,7 +18,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace oracle = odb::oracle;
+using namespace oracle;
int
main (int argc, char* argv[])
@@ -28,7 +29,7 @@ main (int argc, char* argv[])
// Create an Oracle database instance, setting both the client database
// and national character set to UTF-8.
//
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
@@ -206,7 +207,7 @@ main (int argc, char* argv[])
// Test image copying with LOB data.
//
{
- typedef odb::query<blob> query;
+ typedef oracle::query<blob> query;
typedef odb::result<blob> result;
transaction t (db->begin ());
@@ -235,7 +236,7 @@ main (int argc, char* argv[])
// Test descriptor management in TIMESTAMP and INTERVAL images.
//
{
- typedef odb::query<object> query;
+ typedef oracle::query<object> query;
typedef odb::result<object> result;
query q (query::timestamp == o.timestamp_ &&
diff --git a/pgsql/custom/driver.cxx b/pgsql/custom/driver.cxx
index f1f70f8..7188f74 100644
--- a/pgsql/custom/driver.cxx
+++ b/pgsql/custom/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
o.p = point (1.1111, 2222222222.2);
@@ -61,7 +62,7 @@ main (int argc, char* argv[])
// Query.
//
- typedef odb::query<object> query;
+ typedef pgsql::query<object> query;
typedef odb::result<object> result;
{
diff --git a/pgsql/custom/query.hxx b/pgsql/custom/query.hxx
index 4b29b45..432d25b 100644
--- a/pgsql/custom/query.hxx
+++ b/pgsql/custom/query.hxx
@@ -34,18 +34,18 @@ namespace odb
// is_null, is_not_null
//
public:
- query
+ query_base
is_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NULL";
return q;
}
- query
+ query_base
is_not_null () const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "IS NOT NULL";
return q;
}
@@ -53,61 +53,61 @@ namespace odb
// =
//
public:
- query
+ query_base
equal (const point& v) const
{
return equal (val_bind<point> (v));
}
- query
+ query_base
equal (val_bind<point> v) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "~=";
q.append<point, id_string> (v, conversion_);
return q;
}
- query
+ query_base
equal (ref_bind<point> r) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "~=";
q.append<point, id_string> (r, conversion_);
return q;
}
- friend query
+ friend query_base
operator== (const query_column& c, const point& v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const point& v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, val_bind<point> v)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (val_bind<point> v, const query_column& c)
{
return c.equal (v);
}
- friend query
+ friend query_base
operator== (const query_column& c, ref_bind<point> r)
{
return c.equal (r);
}
- friend query
+ friend query_base
operator== (ref_bind<point> r, const query_column& c)
{
return c.equal (r);
@@ -116,10 +116,10 @@ namespace odb
// Column comparison.
//
public:
- query
+ query_base
operator== (const query_column<point, id_string>& c) const
{
- query q (table_, column_);
+ query_base q (table_, column_);
q += "~=";
q.append (c.table (), c.column ());
return q;
diff --git a/pgsql/database/driver.cxx b/pgsql/database/driver.cxx
index 8746c37..68c34ab 100644
--- a/pgsql/database/driver.cxx
+++ b/pgsql/database/driver.cxx
@@ -7,7 +7,8 @@
#include <odb/pgsql/database.hxx>
-using namespace odb::pgsql;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
diff --git a/pgsql/index/driver.cxx b/pgsql/index/driver.cxx
index 48ac5f8..4c46b58 100644
--- a/pgsql/index/driver.cxx
+++ b/pgsql/index/driver.cxx
@@ -1,4 +1,4 @@
-// file : pgsql/template/driver.cxx
+// file : pgsql/index/driver.cxx
// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
@@ -18,7 +18,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
@@ -27,7 +28,7 @@ main (int argc, char* argv[])
{
// This is just a schema creation test.
//
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
{
transaction t (db->begin ());
diff --git a/pgsql/native/driver.cxx b/pgsql/native/driver.cxx
index 94bda60..3e4b680 100644
--- a/pgsql/native/driver.cxx
+++ b/pgsql/native/driver.cxx
@@ -10,18 +10,20 @@
#include <iostream>
#include <odb/pgsql/database.hxx>
+#include <odb/pgsql/transaction.hxx>
#include <common/common.hxx>
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Create the database schema.
//
diff --git a/pgsql/template/driver.cxx b/pgsql/template/driver.cxx
index 329c91c..9297ab0 100644
--- a/pgsql/template/driver.cxx
+++ b/pgsql/template/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
//
//
diff --git a/pgsql/truncation/driver.cxx b/pgsql/truncation/driver.cxx
index eefbdcd..fe72780 100644
--- a/pgsql/truncation/driver.cxx
+++ b/pgsql/truncation/driver.cxx
@@ -18,7 +18,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
@@ -33,7 +34,7 @@ main (int argc, char* argv[])
// Test basic operations.
//
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Run persist/load so that the initial bindings are established
// (version == 0).
@@ -98,10 +99,10 @@ main (int argc, char* argv[])
// Test query.
//
{
- typedef odb::query<object1> query;
+ typedef pgsql::query<object1> query;
typedef odb::result<object1> result;
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Run persist/query so that the initial bindings are established
// (version == 0).
diff --git a/pgsql/types/driver.cxx b/pgsql/types/driver.cxx
index 8b51cc5..8b969aa 100644
--- a/pgsql/types/driver.cxx
+++ b/pgsql/types/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace pgsql = odb::pgsql;
+using namespace pgsql;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
diff --git a/sqlite/custom/driver.cxx b/sqlite/custom/driver.cxx
index 9e387b0..d189767 100644
--- a/sqlite/custom/driver.cxx
+++ b/sqlite/custom/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
o.nv.push_back ("123"); // INTEGER
diff --git a/sqlite/database/driver.cxx b/sqlite/database/driver.cxx
index cb531c6..6e09d30 100644
--- a/sqlite/database/driver.cxx
+++ b/sqlite/database/driver.cxx
@@ -9,7 +9,8 @@
#include <odb/sqlite/database.hxx>
-using namespace odb::sqlite;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
diff --git a/sqlite/native/driver.cxx b/sqlite/native/driver.cxx
index 30f0197..91b04e6 100644
--- a/sqlite/native/driver.cxx
+++ b/sqlite/native/driver.cxx
@@ -15,14 +15,16 @@
#include <common/common.hxx>
using namespace std;
-using namespace odb::core;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv, false));
+ auto_ptr<database> db (
+ create_specific_database<database> (argc, argv, false));
// Create the database schema.
//
diff --git a/sqlite/template/driver.cxx b/sqlite/template/driver.cxx
index 83766fd..c7979df 100644
--- a/sqlite/template/driver.cxx
+++ b/sqlite/template/driver.cxx
@@ -18,14 +18,15 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
//
//
diff --git a/sqlite/truncation/driver.cxx b/sqlite/truncation/driver.cxx
index c8b9dab..70fde25 100644
--- a/sqlite/truncation/driver.cxx
+++ b/sqlite/truncation/driver.cxx
@@ -18,7 +18,8 @@
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
@@ -33,7 +34,7 @@ main (int argc, char* argv[])
// Test basic operations.
//
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
// Run persist/load so that the initial bindings are established
// (version == 0).
@@ -98,10 +99,10 @@ main (int argc, char* argv[])
// Test query.
//
{
- typedef odb::query<object1> query;
- typedef odb::result<object1> result;
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
- auto_ptr<database> db (create_database (argc, argv));
+ typedef sqlite::query<object1> query;
+ typedef odb::result<object1> result;
// Run persist/query so that the initial bindings are established
// (version == 0).
diff --git a/sqlite/types/driver.cxx b/sqlite/types/driver.cxx
index ac8c8d4..69e8473 100644
--- a/sqlite/types/driver.cxx
+++ b/sqlite/types/driver.cxx
@@ -13,21 +13,21 @@
#include <odb/sqlite/database.hxx>
#include <odb/sqlite/transaction.hxx>
-#include <common/buffer.hxx>
#include <common/common.hxx>
#include "test.hxx"
#include "test-odb.hxx"
using namespace std;
-using namespace odb::core;
+namespace sqlite = odb::sqlite;
+using namespace sqlite;
int
main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_specific_database<database> (argc, argv));
object o (1);
@@ -58,7 +58,7 @@ main (int argc, char* argv[])
assert (o == *o1);
}
- typedef odb::query<object> query;
+ typedef sqlite::query<object> query;
typedef odb::result<object> result;
#ifdef _WIN32