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



commit 45a5f46b788fd2c143759f77f5cd6bdab6b3c8bf
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]