/* 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),
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";
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 ();
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++) {