aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/query.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-19 14:08:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-19 14:08:16 +0200
commit1bf4678c29b6e51396c18582b270254d1bd2cddc (patch)
tree61ffcea73445ccf91f41566ab063060f6b314de5 /odb/sqlite/query.txx
parent35c3d273bbf1bd8c9c41ac1c3d91f150df0eb280 (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/sqlite/query.txx')
-rw-r--r--odb/sqlite/query.txx17
1 files changed, 9 insertions, 8 deletions
diff --git a/odb/sqlite/query.txx b/odb/sqlite/query.txx
index 3144348..6af80e7 100644
--- a/odb/sqlite/query.txx
+++ b/odb/sqlite/query.txx
@@ -13,13 +13,14 @@ namespace odb
template <database_type_id ID>
query::
query (const query_column<bool, ID>& c)
- : clause_ (c.name ()),
- parameters_ (new (details::shared) query_params)
+ : parameters_ (new (details::shared) query_params)
{
+ 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));
}
@@ -29,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 += ",";
@@ -42,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 += ",";
@@ -57,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 += ",";
@@ -74,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 += ",";
@@ -94,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)