diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-08 16:09:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-08 16:09:08 +0200 |
commit | 3d1969a43fce72dd50044c5eada38557f3f200bd (patch) | |
tree | 8515c6a535117d4f53bc8fe59feab8129563ebb4 /mysql | |
parent | 6b76715e63d2c265a4c51c73f9019bc578f874cb (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.
Diffstat (limited to 'mysql')
-rw-r--r-- | mysql/custom/driver.cxx | 7 | ||||
-rw-r--r-- | mysql/custom/query.hxx | 34 | ||||
-rw-r--r-- | mysql/database/driver.cxx | 3 | ||||
-rw-r--r-- | mysql/index/driver.cxx | 5 | ||||
-rw-r--r-- | mysql/native/driver.cxx | 5 | ||||
-rw-r--r-- | mysql/template/driver.cxx | 5 | ||||
-rw-r--r-- | mysql/truncation/driver.cxx | 11 | ||||
-rw-r--r-- | mysql/types/driver.cxx | 5 |
8 files changed, 41 insertions, 34 deletions
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); |