[tracker/tracker-id] SPARQL: Add tracker:id function



commit b5f53ac84f449c9fe508ed90cbcc093e47071696
Author: Jürg Billeter <j bitron ch>
Date:   Wed May 19 13:50:34 2010 +0200

    SPARQL: Add tracker:id function
    
    This returns the internal integer ID to be used as last sort key in
    queries. This helps retrieving results in stable order which is
    important for paged queries.

 src/libtracker-data/tracker-sparql-expression.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 0fc949e..784520a 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -554,6 +554,13 @@ class Tracker.Sparql.Expression : Object {
 			sql.append_printf ("\"%s_u_offsets\"", v);
 
 			return PropertyType.STRING;
+		} else if (uri == TRACKER_NS + "id") {
+			var type = translate_expression (sql);
+			if (type != PropertyType.RESOURCE) {
+				throw get_error ("expected resource");
+			}
+
+			return PropertyType.INTEGER;
 		} else if (uri == TRACKER_NS + "cartesian-distance") {
 			sql.append ("SparqlCartesianDistance(");
 			translate_expression (sql);



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