From 87fd08a98063303d4d97e2bdac7b212ae5248914 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 27 Oct 2011 12:36:03 +0200 Subject: Revert to manually quoting Oracle identifiers where necessary --- common/callback/driver.cxx | 8 +------- common/query/driver.cxx | 33 +++++++++++++++++++++++---------- common/view/driver.cxx | 18 +++++++++++------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/common/callback/driver.cxx b/common/callback/driver.cxx index 76dbda4..b22d543 100644 --- a/common/callback/driver.cxx +++ b/common/callback/driver.cxx @@ -95,13 +95,7 @@ main (int argc, char* argv[]) transaction t (db->begin ()); -#ifndef DATABASE_ORACLE - result r (db->query ( - (query::id < 3) + "ORDER BY callback_object.id")); -#else - result r (db->query ( - (query::id < 3) + "ORDER BY \"callback_object\".\"id\"")); -#endif + result r (db->query ((query::id < 3) + "ORDER BY" + query::id)); for (result::iterator i (r.begin ()); i != r.end (); ++i) { diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 1d19860..b94bed6 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -140,10 +140,11 @@ main (int argc, char* argv[]) cout << "test 003" << endl; { transaction t (db->begin ()); - result r ( - db->query (query::age + " >= 30 AND " + - query::last_name + " = 'Doe'")); - +#ifndef DATABASE_ORACLE + result r (db->query ("age >= 30 AND last = 'Doe'")); +#else + result r (db->query ("\"age\" >= 30 AND \"last\" = 'Doe'")); +#endif print (r); t.commit (); } @@ -156,9 +157,17 @@ main (int argc, char* argv[]) const char* name = "Doe"; +#ifndef DATABASE_ORACLE result r ( - db->query (query::age + " >= " + query::_ref (30) + "AND " + - query::last_name + " = " + query::_val (name))); + db->query ( + "age >= " + query::_ref (30) + "AND" + + "last = " + query::_val (name))); +#else + result r ( + db->query ( + "\"age\" >= " + query::_ref (30) + "AND" + + "\"last\" = " + query::_val (name))); +#endif print (r); t.commit (); @@ -173,8 +182,13 @@ main (int argc, char* argv[]) string name; unsigned short age; - query q (query::age + " >= " + query::_ref (age) + "AND" + - query::last_name + " = " + query::_ref (name)); +#ifndef DATABASE_ORACLE + query q ("age >= " + query::_ref (age) + "AND" + + "last = " + query::_ref (name)); +#else + query q ("\"age\" >= " + query::_ref (age) + "AND" + + "\"last\" = " + query::_ref (name)); +#endif name = "Doe"; age = 30; @@ -354,8 +368,7 @@ main (int argc, char* argv[]) // + // r = db->query ((query::last_name == "Doe") + - "ORDER BY" + - query::age); + "ORDER BY" + query::age); print (r); t.commit (); diff --git a/common/view/driver.cxx b/common/view/driver.cxx index b671e46..f6dd613 100644 --- a/common/view/driver.cxx +++ b/common/view/driver.cxx @@ -59,7 +59,11 @@ view2_test (const auto_ptr& db) } { - result r (db->query (query::age + " < 31")); +#ifndef DATABASE_ORACLE + result r (db->query ("age < 31")); +#else + result r (db->query ("\"age\" < 31")); +#endif iterator i (r.begin ()); assert (i != r.end ()); @@ -87,10 +91,11 @@ view4_test (const auto_ptr& db) transaction t (db->begin ()); { - result r (db->query ( - (query::person::age > 30) + - "ORDER BY " + - query::person::age)); +#ifndef DATABASE_ORACLE + result r (db->query ((query::person::age > 30) + "ORDER BY age")); +#else + result r (db->query ((query::person::age > 30) + "ORDER BY \"age\"")); +#endif iterator i (r.begin ()); @@ -108,8 +113,7 @@ view4_test (const auto_ptr& db) { result r (db->query ( (query::person::age > 30) + - "ORDER BY " + - query::person::age)); + "ORDER BY " + query::person::age)); iterator i (r.begin ()); -- cgit v1.1