[tracker] libtracker-data: Add support for the ROUND() builtin function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Add support for the ROUND() builtin function
- Date: Mon, 19 Oct 2015 12:15:19 +0000 (UTC)
commit 183c6b8d797dc853a3a5888fd102e8748c09f066
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jul 28 20:30:41 2015 +0200
libtracker-data: Add support for the ROUND() builtin function
This function is defined in Sparql 1.1 query language recommendation,
http://www.w3.org/TR/sparql11-query/#func-round
src/libtracker-data/tracker-sparql-expression.vala | 6 ++++++
src/libtracker-data/tracker-sparql-scanner.vala | 13 ++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala
b/src/libtracker-data/tracker-sparql-expression.vala
index fc69bde..1e39160 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -1292,6 +1292,12 @@ class Tracker.Sparql.Expression : Object {
type = translate_aggregate_expression (sql);
sql.append (")");
return type;
+ case SparqlTokenType.ROUND:
+ next ();
+ sql.append ("ROUND(");
+ type = translate_aggregate_expression (sql);
+ sql.append (")");
+ return type;
case SparqlTokenType.GROUP_CONCAT:
next ();
sql.append ("GROUP_CONCAT(");
diff --git a/src/libtracker-data/tracker-sparql-scanner.vala b/src/libtracker-data/tracker-sparql-scanner.vala
index 42d8c54..f23f0f3 100644
--- a/src/libtracker-data/tracker-sparql-scanner.vala
+++ b/src/libtracker-data/tracker-sparql-scanner.vala
@@ -233,7 +233,16 @@ public class Tracker.SparqlScanner : Object {
break;
case 'R':
case 'r':
- if (matches (begin, "REGEX")) return SparqlTokenType.REGEX;
+ switch (begin[1]) {
+ case 'E':
+ case 'e':
+ if (matches (begin, "REGEX")) return SparqlTokenType.REGEX;
+ break;
+ case 'O':
+ case 'o':
+ if (matches (begin, "ROUND")) return SparqlTokenType.ROUND;
+ break;
+ }
break;
case 'U':
case 'u':
@@ -992,6 +1001,7 @@ public enum Tracker.SparqlTokenType {
REDUCED,
REGEX,
REPLACE,
+ ROUND,
SAMETERM,
SELECT,
SEMICOLON,
@@ -1097,6 +1107,7 @@ public enum Tracker.SparqlTokenType {
case REDUCED: return "`REDUCED'";
case REGEX: return "`REGEX'";
case REPLACE: return "`REPLACE'";
+ case ROUND: return "`ROUND'";
case SAMETERM: return "`SAMETERM'";
case SELECT: return "`SELECT'";
case SEMICOLON: return "`;'";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]