[tracker/anonymous-file-nodes: 3/27] Add API to TrackerSparqlBuilder to add WHERE clauses.
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/anonymous-file-nodes: 3/27] Add API to TrackerSparqlBuilder to add WHERE clauses.
- Date: Tue, 2 Feb 2010 17:01:26 +0000 (UTC)
commit 2422faee8b6ac1fa296a4024695fcb481e02b0e8
Author: Carlos Garnacho <carlos lanedo com>
Date: Tue Jan 26 12:04:20 2010 +0100
Add API to TrackerSparqlBuilder to add WHERE clauses.
where_open(), where_close() and subject_variable() have been added.
src/libtracker-common/tracker-sparql-builder.vala | 23 +++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-common/tracker-sparql-builder.vala b/src/libtracker-common/tracker-sparql-builder.vala
index 5eda0de..298c8c7 100644
--- a/src/libtracker-common/tracker-sparql-builder.vala
+++ b/src/libtracker-common/tracker-sparql-builder.vala
@@ -26,6 +26,7 @@ public class Tracker.SparqlBuilder : Object {
PREDICATE,
OBJECT,
BLANK,
+ WHERE,
EMBEDDED_INSERT
}
@@ -84,6 +85,28 @@ public class Tracker.SparqlBuilder : Object {
}
}
+ public void where_open ()
+ requires (state == State.UPDATE)
+ {
+ states += State.WHERE;
+ str.append ("WHERE {\n");
+ }
+
+ public void where_close ()
+ requires (state == State.WHERE || state == State.OBJECT)
+ {
+ if (state == State.OBJECT) {
+ str.append (" .\n");
+ states.length -= 3;
+ }
+ states.length--;
+ str.append ("}\n");
+ }
+
+ public void subject_variable (string var_name) {
+ subject ("?%s".printf (var_name));
+ }
+
public void subject_iri (string iri) {
subject ("<%s>".printf (iri));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]