[tracker] SPARQL: Support inserting negative numbers without quotes



commit 705ce8361c8b30e14cb7fcb732502c324977fbd2
Author: Jürg Billeter <j bitron ch>
Date:   Thu Jan 7 14:54:16 2010 +0100

    SPARQL: Support inserting negative numbers without quotes

 src/libtracker-data/tracker-sparql-query.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index b77b05c..5a51968 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -1990,6 +1990,16 @@ public class Tracker.SparqlQuery : Object {
 			// _:foo
 			expect (SparqlTokenType.COLON);
 			result = generate_bnodeid (get_last_string ().substring (1));
+		} else if (current () == SparqlTokenType.MINUS) {
+			next ();
+			if (current () == SparqlTokenType.INTEGER ||
+			    current () == SparqlTokenType.DECIMAL ||
+			    current () == SparqlTokenType.DOUBLE) {
+				next ();
+				result = "-" + get_last_string ();
+			} else {
+				throw get_error ("expected variable or term");
+			}
 		} else if (current () == SparqlTokenType.INTEGER) {
 			next ();
 			result = get_last_string ();



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