[tracker/rss-enclosures] Add http://www.w3.org/2005/xpath-functions#substring() function.



commit a57c27a0abd7a7658ef294ce4f3ba50c6eaf1c7e
Author: Mathias Hasselmann <hasselmm gnome org>
Date:   Mon Apr 12 20:17:02 2010 +0200

    Add http://www.w3.org/2005/xpath-functions#substring() function.
    
    Fixes NB#163544

 src/libtracker-data/tracker-sparql-expression.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 3d68400..31f6f1c 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -447,6 +447,22 @@ class Tracker.Sparql.Expression : Object {
 			sql.append (")");
 
 			return PropertyType.BOOLEAN;
+		} else if (uri == FN_NS + "substring") {
+			sql.append ("substr(");
+			translate_expression_as_string (sql);
+
+			sql.append (", ");
+			expect (SparqlTokenType.COMMA);
+			translate_expression_as_string (sql);
+
+			if (accept (SparqlTokenType.COMMA)) {
+			      sql.append (", ");
+			      translate_expression_as_string (sql);
+			}
+
+			sql.append (")");
+
+			return PropertyType.STRING;
 		} else if (uri == FN_NS + "concat") {
 			translate_expression (sql);
 			sql.append ("||");



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