From 3d1969a43fce72dd50044c5eada38557f3f200bd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Oct 2012 16:09:08 +0200 Subject: 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. --- common/readonly/driver.cxx | 6 +++--- libcommon/common/common.hxx | 12 ++++++++++++ mssql/custom/driver.cxx | 7 ++++--- mssql/custom/query.hxx | 34 +++++++++++++++++----------------- mssql/database/driver.cxx | 3 ++- mssql/native/driver.cxx | 5 +++-- mssql/query/driver.cxx | 7 ++++--- mssql/template/driver.cxx | 5 +++-- mssql/types/driver.cxx | 7 ++++--- mysql/custom/driver.cxx | 7 ++++--- mysql/custom/query.hxx | 34 +++++++++++++++++----------------- mysql/database/driver.cxx | 3 ++- mysql/index/driver.cxx | 5 +++-- mysql/native/driver.cxx | 5 +++-- mysql/template/driver.cxx | 5 +++-- mysql/truncation/driver.cxx | 11 ++++++----- mysql/types/driver.cxx | 5 +++-- oracle/custom/driver.cxx | 5 +++-- oracle/database/driver.cxx | 3 ++- oracle/native/driver.cxx | 5 +++-- oracle/template/driver.cxx | 5 +++-- oracle/types/driver.cxx | 9 +++++---- pgsql/custom/driver.cxx | 7 ++++--- pgsql/custom/query.hxx | 34 +++++++++++++++++----------------- pgsql/database/driver.cxx | 3 ++- pgsql/index/driver.cxx | 7 ++++--- pgsql/native/driver.cxx | 6 ++++-- pgsql/template/driver.cxx | 5 +++-- pgsql/truncation/driver.cxx | 9 +++++---- pgsql/types/driver.cxx | 5 +++-- sqlite/custom/driver.cxx | 5 +++-- sqlite/database/driver.cxx | 3 ++- sqlite/native/driver.cxx | 6 ++++-- sqlite/template/driver.cxx | 5 +++-- sqlite/truncation/driver.cxx | 11 ++++++----- sqlite/types/driver.cxx | 8 ++++---- 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 so_traits; - typedef odb::object_traits ro_traits; - typedef odb::object_traits rw_traits; + typedef odb::object_traits_impl so_traits; + typedef odb::object_traits_impl ro_traits; + typedef odb::object_traits_impl 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 +std::auto_ptr +create_specific_database (int& argc, + char* argv[], + bool create_schema = true, + std::size_t max_connections = 0) +{ + std::auto_ptr r ( + create_database (argc, argv, create_schema, max_connections)); + return std::auto_ptr (&dynamic_cast (*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 db (create_database (argc, argv)); + auto_ptr db (create_specific_database (argc, argv)); object o (1); @@ -58,7 +59,7 @@ main (int argc, char* argv[]) // Query. // - typedef odb::query query; + typedef mssql::query query; typedef odb::result 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 (v)); } - query + query_base equal (val_bind v) const { - query q (table_, column_); + query_base q (table_, column_); q += ".STEquals("; q.append (v, conversion_); q += ") = 1"; return q; } - query + query_base equal (ref_bind r) const { - query q (table_, column_); + query_base q (table_, column_); q += ".STEquals("; q.append (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 v) { return c.equal (v); } - friend query + friend query_base operator== (val_bind v, const query_column& c) { return c.equal (v); } - friend query + friend query_base operator== (const query_column& c, ref_bind r) { return c.equal (r); } - friend query + friend query_base operator== (ref_bind 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& 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 -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 using namespace std; -using namespace odb::core; +namespace mssql = odb::mssql; +using namespace mssql; int main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_database (argc, argv)); { object o1; @@ -63,7 +64,7 @@ main (int argc, char* argv[]) t.commit (); } - typedef odb::query query; + typedef mssql::query query; typedef odb::result 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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_database (argc, argv)); { object o (1); @@ -130,7 +131,7 @@ main (int argc, char* argv[]) // Test short/long data in queries. // - typedef odb::query query; + typedef mssql::query query; typedef odb::result 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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 query; + typedef mysql::query query; typedef odb::result 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 (v)); } - query + query_base equal (val_bind v) const { - query q (table_, column_); + query_base q (table_, column_); q += "="; q.append (v, conversion_); return q; } - query + query_base equal (ref_bind r) const { - query q (table_, column_); + query_base q (table_, column_); q += "="; q.append (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 v) { return c.equal (v); } - friend query + friend query_base operator== (val_bind v, const query_column& c) { return c.equal (v); } - friend query + friend query_base operator== (const query_column& c, ref_bind r) { return c.equal (r); } - friend query + friend query_base operator== (ref_bind 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& 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 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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 using namespace std; -using namespace odb::core; +namespace mysql = odb::mysql; +using namespace mysql; int main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 query; + typedef mysql::query query; typedef odb::result result; - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 -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 using namespace std; -using namespace odb::core; +namespace oracle = odb::oracle; +using namespace oracle; int main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_database (argc, argv)); object o (1); @@ -206,7 +207,7 @@ main (int argc, char* argv[]) // Test image copying with LOB data. // { - typedef odb::query query; + typedef oracle::query query; typedef odb::result 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 query; + typedef oracle::query query; typedef odb::result 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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 query; + typedef pgsql::query query; typedef odb::result 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 (v)); } - query + query_base equal (val_bind v) const { - query q (table_, column_); + query_base q (table_, column_); q += "~="; q.append (v, conversion_); return q; } - query + query_base equal (ref_bind r) const { - query q (table_, column_); + query_base q (table_, column_); q += "~="; q.append (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 v) { return c.equal (v); } - friend query + friend query_base operator== (val_bind v, const query_column& c) { return c.equal (v); } - friend query + friend query_base operator== (const query_column& c, ref_bind r) { return c.equal (r); } - friend query + friend query_base operator== (ref_bind 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& 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 -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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 #include +#include #include using namespace std; -using namespace odb::core; +namespace pgsql = odb::pgsql; +using namespace pgsql; int main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 query; + typedef pgsql::query query; typedef odb::result result; - auto_ptr db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 -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 using namespace std; -using namespace odb::core; +namespace sqlite = odb::sqlite; +using namespace sqlite; int main (int argc, char* argv[]) { try { - auto_ptr db (create_database (argc, argv, false)); + auto_ptr db ( + create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 db (create_database (argc, argv)); + auto_ptr db (create_specific_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 query; - typedef odb::result result; + auto_ptr db (create_specific_database (argc, argv)); - auto_ptr db (create_database (argc, argv)); + typedef sqlite::query query; + typedef odb::result 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 #include -#include #include #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 db (create_database (argc, argv)); + auto_ptr db (create_specific_database (argc, argv)); object o (1); @@ -58,7 +58,7 @@ main (int argc, char* argv[]) assert (o == *o1); } - typedef odb::query query; + typedef sqlite::query query; typedef odb::result result; #ifdef _WIN32 -- cgit v1.1