[rygel] tracker: Query executes itself
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Query executes itself
- Date: Sat, 5 Dec 2009 01:21:24 +0000 (UTC)
commit 7e2d21e5544ee335ade8b4d81e1c63aca9613b04
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Dec 2 03:01:38 2009 +0200
tracker: Query executes itself
.../tracker/rygel-tracker-metadata-values.vala | 3 +--
src/plugins/tracker/rygel-tracker-query.vala | 8 ++++++++
.../tracker/rygel-tracker-search-container.vala | 10 ++--------
3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index 3bf6e5d..093de97 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -111,8 +111,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
/* FIXME: We need to hook to some tracker signals to keep
* this field up2date at all times
*/
- debug ("Executing SPARQL query: %s", query.to_string ());
- values = yield this.resources.sparql_query (query.to_string ());
+ values = yield query.execute (this.resources);
} catch (DBus.Error error) {
critical ("error getting all values for '%s': %s",
string.joinv (" -> ", this.key_chain),
diff --git a/src/plugins/tracker/rygel-tracker-query.vala b/src/plugins/tracker/rygel-tracker-query.vala
index 746a842..e0b8878 100644
--- a/src/plugins/tracker/rygel-tracker-query.vala
+++ b/src/plugins/tracker/rygel-tracker-query.vala
@@ -74,6 +74,14 @@ public class Rygel.TrackerQuery {
query.max_count);
}
+ public async string[,] execute (TrackerResourcesIface resources)
+ throws DBus.Error {
+ var str = this.to_string ();
+
+ debug ("Executing SPARQL query: %s", str);
+ return yield resources.sparql_query (str);
+ }
+
public string to_string () {
string query = "SELECT";
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 0646d79..57cac9c 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -108,10 +108,7 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
query.variables.add ("COUNT(" + ITEM_VARIABLE + ") AS x");
query.optional = new TrackerQueryTriplets ();
- var query_str = query.to_string ();
-
- debug ("Executing SPARQL query: %s", query_str);
- var result = yield this.resources.sparql_query (query_str);
+ var result = yield query.execute (this.resources);
this.child_count = result[0,0].to_int ();
this.updated ();
@@ -164,10 +161,7 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
return results;
}
- var query_str = query.to_string ();
-
- debug ("Executing SPARQL query: %s", query_str);
- var search_result = yield this.resources.sparql_query (query_str);
+ var search_result = yield query.execute (this.resources);
/* Iterate through all items */
for (uint i = 0; i < search_result.length[0]; i++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]