[tracker/harmattan-pre-signal-updates: 1333/1380] libtracker-bus: Implement get_variable_name and get_value_type for arraycursor
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/harmattan-pre-signal-updates: 1333/1380] libtracker-bus: Implement get_variable_name and get_value_type for arraycursor
- Date: Wed, 22 Sep 2010 15:46:21 +0000 (UTC)
commit cf756de37f5f7a0efa4155a222cd48db19b9f19f
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Sep 14 12:13:06 2010 +0200
libtracker-bus: Implement get_variable_name and get_value_type for arraycursor
src/libtracker-bus/tracker-array-cursor.vala | 18 +++++++-----------
src/libtracker-bus/tracker-bus.vala | 26 ++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-array-cursor.vala b/src/libtracker-bus/tracker-array-cursor.vala
index df288ff..ecc1d51 100644
--- a/src/libtracker-bus/tracker-array-cursor.vala
+++ b/src/libtracker-bus/tracker-array-cursor.vala
@@ -21,32 +21,28 @@ internal class Tracker.Bus.ArrayCursor : Tracker.Sparql.Cursor {
int rows;
int current_row = -1;
string[,] results;
+ string[] var_names;
+ Sparql.ValueType[] types;
int cols;
- public ArrayCursor (owned string[,] results, int rows, int cols) {
+ public ArrayCursor (owned string[,] results, int rows, int cols, string[] var_names, Sparql.ValueType[] types) {
this.rows = rows;
this.cols = cols;
this.results = (owned) results;
+ this.types = types;
+ this.var_names = var_names;
}
public override int n_columns { get { return cols; } }
public override Sparql.ValueType get_value_type (int column)
requires (current_row >= 0) {
-
- // TODO: Implement
- critical ("Unimplemented");
-
- return Sparql.ValueType.UNBOUND;
+ return this.types[column];
}
public override unowned string? get_variable_name (int column)
requires (current_row >= 0) {
-
- // TODO: Implement
- critical ("Unimplemented");
-
- return null;
+ return this.var_names[column];
}
public override unowned string? get_string (int column, out long length = null)
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 58fa0db..ce3f941 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -153,12 +153,23 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
public override Sparql.Cursor? statistics (Cancellable? cancellable = null) throws Sparql.Error, IOError {
try {
string[,] results = statistics_object.Get ();
+ Sparql.ValueType[] types = new Sparql.ValueType[2];
+ string[] var_names = new string[2];
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ var_names[0] = "class";
+ var_names[1] = "count";
+ types[0] = Sparql.ValueType.STRING;
+ types[1] = Sparql.ValueType.INTEGER;
+
+ return new Tracker.Bus.ArrayCursor ((owned) results,
+ results.length[0],
+ results.length[1],
+ var_names,
+ types);
} catch (DBus.Error e) {
throw new Sparql.Error.INTERNAL (e.message);
}
@@ -167,12 +178,23 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
public async override Sparql.Cursor? statistics_async (Cancellable? cancellable = null) throws Sparql.Error, IOError {
try {
string[,] results = yield statistics_object.Get_async ();
+ Sparql.ValueType[] types = new Sparql.ValueType[2];
+ string[] var_names = new string[2];
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
- return new Tracker.Bus.ArrayCursor ((owned) results, results.length[0], results.length[1]);
+ var_names[0] = "class";
+ var_names[1] = "count";
+ types[0] = Sparql.ValueType.STRING;
+ types[1] = Sparql.ValueType.INTEGER;
+
+ return new Tracker.Bus.ArrayCursor ((owned) results,
+ results.length[0],
+ results.length[1],
+ var_names,
+ types);
} catch (DBus.Error e) {
throw new Sparql.Error.INTERNAL (e.message);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]