[tracker/anonymous-file-nodes: 9/26] Added support for DELETE to TrackerSparqlBuilder class



commit 70f593bc651238e55bf08471f6c1e9875ff2f5ed
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jan 26 16:53:06 2010 +0100

    Added support for DELETE to TrackerSparqlBuilder class

 src/libtracker-common/tracker-sparql-builder.vala |   28 ++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-common/tracker-sparql-builder.vala b/src/libtracker-common/tracker-sparql-builder.vala
index 298c8c7..8dcc6f1 100644
--- a/src/libtracker-common/tracker-sparql-builder.vala
+++ b/src/libtracker-common/tracker-sparql-builder.vala
@@ -85,6 +85,28 @@ public class Tracker.SparqlBuilder : Object {
 		}
 	}
 
+	public void delete_open (string? graph)
+		requires (state == State.UPDATE)
+	{
+		states += State.DELETE;
+		if (graph != null)
+			str.append ("DELETE FROM <%s> {\n".printf (graph));
+		else
+			str.append ("DELETE {\n");
+	}
+
+	public void delete_close ()
+		requires (state == State.DELETE || state == State.OBJECT)
+	{
+		if (state == State.OBJECT) {
+			str.append (" .\n");
+			states.length -= 3;
+		}
+		states.length--;
+
+		str.append ("}\n");
+	}
+
 	public void where_open ()
 	       requires (state == State.UPDATE)
 	{
@@ -107,12 +129,16 @@ public class Tracker.SparqlBuilder : Object {
 		subject ("?%s".printf (var_name));
 	}
 
+	public void object_variable (string var_name) {
+		object ("?%s".printf (var_name));
+	}
+
 	public void subject_iri (string iri) {
 		subject ("<%s>".printf (iri));
 	}
 
 	public void subject (string s)
-		requires (state == State.INSERT || state == State.OBJECT || state == State.EMBEDDED_INSERT)
+		requires (state == State.INSERT || state == State.OBJECT || state == State.EMBEDDED_INSERT || state == State.DELETE || state == State.WHERE)
 	{
 		if (state == State.OBJECT) {
 			str.append (" .\n");



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