[tracker/direct-access: 140/158] libtracker-sparql, libtracker-bus: Fix default update-blank method
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access: 140/158] libtracker-sparql, libtracker-bus: Fix default update-blank method
- Date: Thu, 5 Aug 2010 16:39:20 +0000 (UTC)
commit 51ddcbbf544b6965a8f1f21b898b7f55ac1af7db
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Jul 26 10:42:42 2010 +0200
libtracker-sparql, libtracker-bus: Fix default update-blank method
src/libtracker-bus/tracker-bus.vala | 25 +++++++---------------
src/libtracker-sparql/tracker-plugin-loader.vala | 8 +++++++
tests/functional-tests/default-update-test.vala | 11 ++++++++-
tests/functional-tests/shared-update-test.vala | 13 +++--------
4 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 745c3f8..f2a2600 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -142,30 +142,21 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
public override GLib.Variant? update_blank (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
GLib.Variant res = null;
- try {
- if (use_steroids) {
- res = tracker_bus_fd_sparql_update_blank (connection, sparql);
- } else {
- res = tracker_bus_array_sparql_update_blank (connection, sparql);
- }
- } catch (DBus.Error e) {
- throw new Sparql.Error.INTERNAL (e.message);
+ if (use_steroids) {
+ res = tracker_bus_fd_sparql_update_blank (connection, sparql);
+ } else {
+ res = tracker_bus_array_sparql_update_blank (connection, sparql);
}
-
return res;
}
public async override GLib.Variant? update_blank_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
GLib.Variant res = null;
- try {
- if (use_steroids) {
- res = yield tracker_bus_fd_sparql_update_blank_async (connection, sparql, cancellable);
- } else {
- res = yield tracker_bus_array_sparql_update_blank_async (connection, sparql, cancellable);
- }
- } catch (DBus.Error e) {
- throw new Sparql.Error.INTERNAL (e.message);
+ if (use_steroids) {
+ res = yield tracker_bus_fd_sparql_update_blank_async (connection, sparql, cancellable);
+ } else {
+ res = yield tracker_bus_array_sparql_update_blank_async (connection, sparql, cancellable);
}
return res;
diff --git a/src/libtracker-sparql/tracker-plugin-loader.vala b/src/libtracker-sparql/tracker-plugin-loader.vala
index 33ca3d8..56eb36e 100644
--- a/src/libtracker-sparql/tracker-plugin-loader.vala
+++ b/src/libtracker-sparql/tracker-plugin-loader.vala
@@ -59,10 +59,18 @@ class Tracker.Sparql.PluginLoader : Connection {
bus.update (sparql, cancellable);
}
+ public override GLib.Variant? update_blank (string sparql, Cancellable? cancellable = null) throws Sparql.Error {
+ return bus.update_blank (sparql, cancellable);
+ }
+
public async override void update_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
yield bus.update_async (sparql, priority, cancellable);
}
+ public async override GLib.Variant? update_blank_async (string sparql, int priority = GLib.Priority.DEFAULT, Cancellable? cancellable = null) throws Sparql.Error {
+ return yield bus.update_blank_async (sparql, priority, cancellable);
+ }
+
public override void update_commit (Cancellable? cancellable = null) throws Sparql.Error {
bus.update_commit (cancellable);
}
diff --git a/tests/functional-tests/default-update-test.vala b/tests/functional-tests/default-update-test.vala
index 54914f1..59ec0e8 100644
--- a/tests/functional-tests/default-update-test.vala
+++ b/tests/functional-tests/default-update-test.vala
@@ -1,7 +1,14 @@
int
main( string[] args )
{
- TestApp app = new TestApp (Tracker.Sparql.Connection.get());
+ int res = -1;
- return app.run ();
+ try {
+ TestApp app = new TestApp (Tracker.Sparql.Connection.get());
+ res = app.run();
+ } catch (Tracker.Sparql.Error e) {
+ warning ("Couldn't perform test: %s", e.message);
+ }
+
+ return res;
}
diff --git a/tests/functional-tests/shared-update-test.vala b/tests/functional-tests/shared-update-test.vala
index 355f1be..caa7bc4 100644
--- a/tests/functional-tests/shared-update-test.vala
+++ b/tests/functional-tests/shared-update-test.vala
@@ -63,14 +63,14 @@ public class TestApp : GLib.Object {
int a;
try {
- yield con.update_async ("INSERT { <test01> a nie:InformationElement ; nie:title 'test01' }");
+ yield con.update_async ("INSERT { <test02> a nie:InformationElement ; nie:title 'test01' }");
} catch (Tracker.Sparql.Error ea) {
warning ("Couldn't update: %s", ea.message);
res = -1;
}
try {
- cursor = con.query ("SELECT ?title WHERE { <test01> nie:title ?title }");
+ cursor = con.query ("SELECT ?title WHERE { <test02> nie:title ?title }");
a = iter_cursor (cursor);
} catch (Tracker.Sparql.Error eb) {
warning ("Couldn't query: %s", eb.message);
@@ -78,15 +78,12 @@ public class TestApp : GLib.Object {
}
}
-
- string blank_query = "INSERT { _:a2 a nie:InformationElement . _:b2 a nie:InformationElement . _:c2 a nie:InformationElement }";
-
void update_blank_query () {
GLib.Variant variant;
int a;
try {
- variant = con.update_blank (blank_query);
+ variant = con.update_blank ("INSERT { _:a1 a nie:InformationElement . _:b1 a nie:InformationElement . _:c1 a nie:InformationElement }");
a = iter_variant (variant);
} catch (Tracker.Sparql.Error ea) {
warning ("Couldn't update: %s", ea.message);
@@ -94,14 +91,12 @@ public class TestApp : GLib.Object {
}
}
-
-
async void update_blank_query_async () {
GLib.Variant variant;
int a;
try {
- variant = yield con.update_blank_async (blank_query);
+ variant = yield con.update_blank_async ("INSERT { _:a2 a nie:InformationElement . _:b2 a nie:InformationElement . _:c2 a nie:InformationElement }");
a = iter_variant (variant);
} catch (Tracker.Sparql.Error ea) {
warning ("Couldn't update: %s", ea.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]