diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-10-26 10:05:25 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-10-26 17:15:52 +0200 |
commit | 1f14eecfed1303d5d7bf5febcba29e06c2d19d9e (patch) | |
tree | 08e5cdfc1392df9519d9079b0abac0d3a6c3f7b8 /common/query/driver.cxx | |
parent | 82c04419fe56ef491c40a02c316338bfc380787f (diff) |
Quote schema object identifiers for Oracle where necessary
Oracle converts all alphabetical characters in unquoted schema object
identifiers to uppercase. This behaviour cannot be disabled.
Diffstat (limited to 'common/query/driver.cxx')
-rw-r--r-- | common/query/driver.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 2f97f2e..283ea12 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -108,7 +108,7 @@ main (int argc, char* argv[]) cout << "test 002" << endl; { transaction t (db->begin ()); - result r (db->query<person> ("ORDER BY age")); + result r (db->query<person> ("ORDER BY" + query::age)); for (result::iterator i (r.begin ()); i != r.end (); ++i) { @@ -132,7 +132,10 @@ main (int argc, char* argv[]) cout << "test 003" << endl; { transaction t (db->begin ()); - result r (db->query<person> ("age >= 30 AND last = 'Doe'")); + result r ( + db->query<person> (query::age + " >= 30 AND " + + query::last_name + " = 'Doe'")); + print (r); t.commit (); } @@ -146,9 +149,8 @@ main (int argc, char* argv[]) const char* name = "Doe"; result r ( - db->query<person> ( - "age >= " + query::_ref (30) + "AND" + - "last = " + query::_val (name))); + db->query<person> (query::age + " >= " + query::_ref (30) + "AND " + + query::last_name + " = " + query::_val (name))); print (r); t.commit (); @@ -163,8 +165,8 @@ main (int argc, char* argv[]) string name; unsigned short age; - query q ("age >= " + query::_ref (age) + "AND" + - "last = " + query::_ref (name)); + query q (query::age + " >= " + query::_ref (age) + "AND" + + query::last_name + " = " + query::_ref (name)); name = "Doe"; age = 30; @@ -343,7 +345,9 @@ main (int argc, char* argv[]) // + // - r = db->query<person> ((query::last_name == "Doe") + "ORDER BY age"); + r = db->query<person> ((query::last_name == "Doe") + + "ORDER BY" + + query::age); print (r); t.commit (); |