[tracker/parser] SPARQL: Fix aggregate functions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/parser] SPARQL: Fix aggregate functions
- Date: Wed, 12 Aug 2009 11:56:57 +0000 (UTC)
commit 2b51b230e9390e6955080416c2b9eb31532c47b4
Author: Jürg Billeter <j bitron ch>
Date: Wed Aug 12 13:55:40 2009 +0200
SPARQL: Fix aggregate functions
src/libtracker-data/tracker-sparql-query.vala | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 54a1d2e..659d4b9 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -490,7 +490,7 @@ public class Tracker.SparqlQuery : Object {
return stmt.execute ();
}
- void skip_select_variables () {
+ void skip_select_variables () throws SparqlError {
while (true) {
switch (current ()) {
case SparqlTokenType.FROM:
@@ -510,27 +510,37 @@ public class Tracker.SparqlQuery : Object {
}
}
- void translate_select_expression (StringBuilder sql) {
+ void translate_select_expression (StringBuilder sql) throws SparqlError {
if (accept (SparqlTokenType.COUNT)) {
sql.append ("COUNT(");
translate_bracketted_expression_as_string (sql);
sql.append (")");
+ expect (SparqlTokenType.AS);
+ expect (SparqlTokenType.PN_PREFIX);
} else if (accept (SparqlTokenType.SUM)) {
sql.append ("SUM(");
translate_bracketted_expression_as_string (sql);
sql.append (")");
+ expect (SparqlTokenType.AS);
+ expect (SparqlTokenType.PN_PREFIX);
} else if (accept (SparqlTokenType.AVG)) {
sql.append ("AVG(");
translate_bracketted_expression_as_string (sql);
sql.append (")");
+ expect (SparqlTokenType.AS);
+ expect (SparqlTokenType.PN_PREFIX);
} else if (accept (SparqlTokenType.MIN)) {
sql.append ("MIN(");
translate_bracketted_expression_as_string (sql);
sql.append (")");
+ expect (SparqlTokenType.AS);
+ expect (SparqlTokenType.PN_PREFIX);
} else if (accept (SparqlTokenType.MAX)) {
sql.append ("MAX(");
translate_bracketted_expression_as_string (sql);
sql.append (")");
+ expect (SparqlTokenType.AS);
+ expect (SparqlTokenType.PN_PREFIX);
} else {
translate_primary_expression_as_string (sql);
}
@@ -589,7 +599,7 @@ public class Tracker.SparqlQuery : Object {
first = false;
}
- translate_primary_expression_as_string (sql);
+ translate_select_expression (sql);
switch (current ()) {
case SparqlTokenType.FROM:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]