[tracker/subqueries: 2/2] SPARQL: Support COUNT in subqueries



commit d1bd8a5341d35c101b7bb33fb53d4afad7454538
Author: Jürg Billeter <j bitron ch>
Date:   Thu Dec 3 17:57:10 2009 +0200

    SPARQL: Support COUNT in subqueries

 src/libtracker-data/tracker-sparql-query.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index df030bf..bbac1e3 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -581,7 +581,9 @@ public class Tracker.SparqlQuery : Object {
 			translate_expression_as_string (sql);
 			sql.append (")");
 			if (accept (SparqlTokenType.AS)) {
-				expect (SparqlTokenType.PN_PREFIX);
+				expect (SparqlTokenType.VAR);
+				string variable_name = get_last_string ().substring (1);
+				sql.append_printf (" AS %s", get_variable (variable_name).sql_expression);
 			}
 		} else if (accept (SparqlTokenType.SUM)) {
 			sql.append ("SUM(");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]