summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-07-28 20:28:08 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-10-19 00:11:58 +0200
commitd48290f437ab00c2662d42c98cd549fac4023848 (patch)
tree6bb30e760bb39a1804cfa8d3d3c8ac751f772a37
parentb69accb3b0e6184235cade5c29cd1843b45a9840 (diff)
downloadtracker-d48290f437ab00c2662d42c98cd549fac4023848.tar.gz
libtracker-data: Add support for the CONCAT() builtin function
This function is defined in Sparql 1.1 query language recommendation, http://www.w3.org/TR/sparql11-query/#func-concat
-rw-r--r--src/libtracker-data/tracker-sparql-expression.vala6
-rw-r--r--src/libtracker-data/tracker-sparql-scanner.vala6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 8633b20bc..d9ca3b8d4 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -1172,6 +1172,12 @@ class Tracker.Sparql.Expression : Object {
var result = translate_function (sql, TRACKER_NS + "coalesce");
expect (SparqlTokenType.CLOSE_PARENS);
return result;
+ case SparqlTokenType.CONCAT:
+ next ();
+ expect (SparqlTokenType.OPEN_PARENS);
+ var result = translate_function (sql, FN_NS + "concat");
+ expect (SparqlTokenType.CLOSE_PARENS);
+ return result;
case SparqlTokenType.IF:
return translate_if_call (sql);
case SparqlTokenType.SAMETERM:
diff --git a/src/libtracker-data/tracker-sparql-scanner.vala b/src/libtracker-data/tracker-sparql-scanner.vala
index 7a52cdcf2..77983f456 100644
--- a/src/libtracker-data/tracker-sparql-scanner.vala
+++ b/src/libtracker-data/tracker-sparql-scanner.vala
@@ -256,6 +256,10 @@ public class Tracker.SparqlScanner : Object {
break;
case 6:
switch (begin[0]) {
+ case 'C':
+ case 'c':
+ if (matches (begin, "CONCAT")) return SparqlTokenType.CONCAT;
+ break;
case 'D':
case 'd':
if (matches (begin, "DELETE")) return SparqlTokenType.DELETE;
@@ -872,6 +876,7 @@ public enum Tracker.SparqlTokenType {
CLOSE_PARENS,
COALESCE,
COLON,
+ CONCAT,
COMMA,
CONSTRUCT,
COUNT,
@@ -972,6 +977,7 @@ public enum Tracker.SparqlTokenType {
case CLOSE_PARENS: return "`)'";
case COALESCE: return "`COALESCE'";
case COLON: return "`:'";
+ case CONCAT: return "`CONCAT'";
case COMMA: return "`,'";
case CONSTRUCT: return "`CONSTRUCT'";
case COUNT: return "`COUNT'";