[tracker] Fix AS ?foo handling in FTS queries
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Fix AS ?foo handling in FTS queries
- Date: Mon, 8 Apr 2013 13:55:59 +0000 (UTC)
commit 0ea1d5f9d3f9b58de6ec738cd3dc65c1f993682b
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Apr 8 15:43:20 2013 +0200
Fix AS ?foo handling in FTS queries
FTS queries implicitly add an "AS var" clause to the translated
SQL select query so values can be matched with the outer query that
accesses FTS tables, which resulted in doubly added AS clauses if
it was specified explicitly in SPARQL too.
So, make sure the clause is just added once.
src/libtracker-data/tracker-sparql-expression.vala | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala
b/src/libtracker-data/tracker-sparql-expression.vala
index 5ea69fb..aa59b02 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -126,6 +126,7 @@ class Tracker.Sparql.Expression : Object {
internal PropertyType translate_select_expression (StringBuilder sql, bool subquery, int
variable_index) throws Sparql.Error {
Variable variable = null;
bool expect_close_parens = false;
+ bool as_handled = false;
long begin = sql.len;
var type = PropertyType.UNKNOWN;
@@ -180,6 +181,7 @@ class Tracker.Sparql.Expression : Object {
variable = context.get_variable (get_last_string ().substring (1));
}
sql.append_printf (" AS %s", variable.sql_expression);
+ as_handled = true;
if (subquery) {
var binding = new VariableBinding ();
@@ -199,7 +201,10 @@ class Tracker.Sparql.Expression : Object {
if (fts_sql == null) {
pattern.fts_variables += variable.sql_expression;
- sql.append_printf (" AS %s", variable.sql_expression);
+
+ if (as_handled == false) {
+ sql.append_printf (" AS %s", variable.sql_expression);
+ }
} else {
pattern.fts_variables += fts_sql;
pattern.queries_fts_data = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]