From 6e3ac760696d4ec43138b1aba82426582c767072 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 19 Aug 2011 14:08:16 +0200 Subject: 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. --- odb/pgsql/query.txx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'odb/pgsql/query.txx') diff --git a/odb/pgsql/query.txx b/odb/pgsql/query.txx index 7d80f2b..6fdc4fe 100644 --- a/odb/pgsql/query.txx +++ b/odb/pgsql/query.txx @@ -13,12 +13,14 @@ namespace odb template query:: query (const query_column& c) - : clause_ (c.name ()), binding_ (0, 0), native_binding_ (0, 0, 0, 0) + : binding_ (0, 0), native_binding_ (0, 0, 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 (val_bind (true)); } @@ -28,7 +30,7 @@ namespace odb query query_column:: in (const T& v1, const T& v2) const { - query q (name_); + query q (name_, query::clause_part::column); q += "IN ("; q.append (val_bind (v1)); q += ","; @@ -41,7 +43,7 @@ namespace odb query query_column:: 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 (val_bind (v1)); q += ","; @@ -56,7 +58,7 @@ namespace odb query query_column:: 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 (val_bind (v1)); q += ","; @@ -73,7 +75,7 @@ namespace odb query query_column:: 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 (val_bind (v1)); q += ","; @@ -93,7 +95,7 @@ namespace odb query query_column:: 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) -- cgit v1.1