diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-19 14:08:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-19 14:08:16 +0200 |
commit | 47d344f31f7a1a980d807c142e0a36b09db3b1f3 (patch) | |
tree | f139dc6f50bb9a8f89d075a23315cd19cc7d9ee3 /odb/mysql/query.txx | |
parent | e4420208045f1bfb1a9c1fc726b4f6d1ae268f92 (diff) |
Rework query machinery not to use '_' as primary table alias
Now we always qualify with the actual table name and use the '_'
alias for situations where an object is referencing itself.
Diffstat (limited to 'odb/mysql/query.txx')
-rw-r--r-- | odb/mysql/query.txx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/odb/mysql/query.txx b/odb/mysql/query.txx index 8cbe201..6addb65 100644 --- a/odb/mysql/query.txx +++ b/odb/mysql/query.txx @@ -13,12 +13,14 @@ namespace odb template <database_type_id ID> query:: query (const query_column<bool, ID>& c) - : clause_ (c.name ()), binding_ (0, 0) + : binding_ (0, 0) { + clause_.push_back (clause_part (clause_part::column, c.name ())); + // Cannot use IS TRUE here since database type can be a non- // integral type. // - clause_ += " = "; + clause_.push_back (clause_part (clause_part::native, "=")); append<bool, ID> (val_bind<bool> (true)); } @@ -28,7 +30,7 @@ namespace odb query query_column<T, ID>:: in (const T& v1, const T& v2) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; q.append<T, ID> (val_bind<T> (v1)); q += ","; @@ -41,7 +43,7 @@ namespace odb query query_column<T, ID>:: in (const T& v1, const T& v2, const T& v3) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; q.append<T, ID> (val_bind<T> (v1)); q += ","; @@ -56,7 +58,7 @@ namespace odb query query_column<T, ID>:: in (const T& v1, const T& v2, const T& v3, const T& v4) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; q.append<T, ID> (val_bind<T> (v1)); q += ","; @@ -73,7 +75,7 @@ namespace odb query query_column<T, ID>:: in (const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; q.append<T, ID> (val_bind<T> (v1)); q += ","; @@ -93,7 +95,7 @@ namespace odb query query_column<T, ID>:: in_range (I begin, I end) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; for (I i (begin); i != end; ++i) |