[tracker/multi-insert: 4/11] libtracker-bus: Read errors out in client API for multi-insert
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/multi-insert: 4/11] libtracker-bus: Read errors out in client API for multi-insert
- Date: Thu, 7 Oct 2010 12:42:32 +0000 (UTC)
commit f3280a4c758a62acd2f26c453809462a219108c0
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Oct 6 13:46:45 2010 +0200
libtracker-bus: Read errors out in client API for multi-insert
src/libtracker-bus/tracker-bus-fd-update.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus-fd-update.c b/src/libtracker-bus/tracker-bus-fd-update.c
index 9cf1e63..b1d0c26 100644
--- a/src/libtracker-bus/tracker-bus-fd-update.c
+++ b/src/libtracker-bus/tracker-bus-fd-update.c
@@ -211,6 +211,7 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
DBusMessage *reply;
GError *error = NULL;
GPtrArray *errors;
+ DBusMessageIter iter, subiter;
/* Check for errors */
reply = dbus_pending_call_steal_reply (call);
@@ -235,7 +236,23 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
switch (fad->operation_type) {
case FAST_UPDATE:
case FAST_UPDATE_BATCH:
- // todo: read errors into errors
+ dbus_message_iter_init (reply, &iter);
+ dbus_message_iter_recurse (&iter, &subiter);
+
+ errors = g_ptr_array_new_with_free_func ((GDestroyNotify) g_error_free);
+
+ while (dbus_message_iter_get_arg_type (&subiter) != DBUS_TYPE_INVALID) {
+ gchar *code, *message;
+ GError *error;
+
+ dbus_message_iter_get_basic (&subiter, &code);
+ dbus_message_iter_next (&subiter);
+ dbus_message_iter_get_basic (&subiter, &message);
+ error = g_error_new_literal (TRACKER_SPARQL_ERROR, 0, message);
+ g_free (code);
+ g_free (message);
+ g_ptr_array_add (errors, error);
+ }
g_simple_async_result_set_op_res_gpointer (fad->res, errors, NULL);
g_simple_async_result_complete (fad->res);
@@ -780,7 +797,6 @@ tracker_bus_fd_sparql_update_array_finish (GAsyncResult *res)
{
g_return_val_if_fail (res != NULL, NULL);
- // todo: check if ref is needed here
return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
}
@@ -789,6 +805,5 @@ tracker_bus_fd_sparql_batch_update_array_finish (GAsyncResult *res)
{
g_return_val_if_fail (res != NULL, NULL);
- // todo: check if ref is needed here
return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]