[tracker/direct-access: 35/47] libtracker-sparql: Add async API



commit 8c07d1a8c62bb5f6ab71ed6a32438e950eebedd3
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jul 13 14:42:27 2010 +0200

    libtracker-sparql: Add async API

 src/libtracker-direct/tracker-connection.vala |    7 ++++++-
 src/libtracker-sparql/tracker-connection.vala |    3 ++-
 src/libtracker-sparql/tracker-cursor.vala     |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-connection.vala b/src/libtracker-direct/tracker-connection.vala
index f3bbbb9..9c9bf90 100644
--- a/src/libtracker-direct/tracker-connection.vala
+++ b/src/libtracker-direct/tracker-connection.vala
@@ -33,12 +33,17 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
 		initialized = false;
 	}
 
-	public override Sparql.Cursor query (string sparql) throws GLib.Error {
+	public override Sparql.Cursor query (string sparql, Cancellable? cancellable) throws GLib.Error {
 		var query_object = new Sparql.Query (sparql);
 		var cursor = query_object.execute_cursor ();
 		cursor.connection = this;
 		return cursor;
 	}
+
+	public async override Sparql.Cursor query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error {
+		// just creating the cursor won't block
+		return query (sparql, cancellable);
+	}
 }
 
 public Tracker.Sparql.Connection module_init (Tracker.Sparql.PluginLoader loader) {
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index f576d5c..f774b2c 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -18,5 +18,6 @@
  */
 
 public abstract class Tracker.Sparql.Connection : Object {
-	public abstract Cursor query (string sparql) throws GLib.Error;
+	public abstract Cursor query (string sparql, Cancellable? cancellable = null) throws GLib.Error;
+	public async abstract Cursor query_async (string sparql, Cancellable? cancellable = null) throws GLib.Error;
 }
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index bc69ba3..8aac0ed 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -23,5 +23,6 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	public abstract unowned string get_string (int column, out int length = null);
 
 	public abstract bool next (Cancellable? cancellable = null) throws GLib.Error;
+	public async abstract bool next_async (Cancellable? cancellable = null) throws GLib.Error;
 	public abstract void rewind ();
 }



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