[tracker] libtracker-data: Fix error handling in tracker_data_delete_statement
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Fix error handling in tracker_data_delete_statement
- Date: Wed, 19 Aug 2009 14:42:13 +0000 (UTC)
commit 6fe7667fd72331020639b0b467de41d8733ddad0
Author: Jürg Billeter <j bitron ch>
Date: Wed Aug 19 16:38:13 2009 +0200
libtracker-data: Fix error handling in tracker_data_delete_statement
Fixes NB#131853.
src/libtracker-data/libtracker-data.vapi | 2 +-
src/libtracker-data/tracker-data-update.c | 17 ++++++++++-------
src/libtracker-data/tracker-data-update.h | 3 ++-
src/tracker-store/tracker-store.c | 2 +-
4 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index 704c633..89f7c62 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -30,7 +30,7 @@ namespace Tracker {
public int query_resource_id (string uri);
public void begin_transaction ();
public void commit_transaction ();
- public void delete_statement (string subject, string predicate, string object);
+ public void delete_statement (string subject, string predicate, string object) throws DataError;
public void insert_statement (string subject, string predicate, string object) throws DataError;
public void insert_statement_with_uri (string subject, string predicate, string object) throws DataError;
public void insert_statement_with_string (string subject, string predicate, string object) throws DataError;
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index cd82bac..f41ad4b 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -757,7 +757,8 @@ delete_metadata_decomposed (gint resource_id,
void
tracker_data_delete_statement (const gchar *subject,
const gchar *predicate,
- const gchar *object)
+ const gchar *object,
+ GError **error)
{
TrackerClass *class;
TrackerProperty *field;
@@ -809,7 +810,7 @@ tracker_data_delete_statement (const gchar *subject,
gchar *class_uri;
tracker_db_result_set_get (result_set, 0, &class_uri, -1);
- tracker_data_delete_statement (subject, predicate, class_uri);
+ tracker_data_delete_statement (subject, predicate, class_uri, NULL);
g_free (class_uri);
} while (tracker_db_result_set_iter_next (result_set));
@@ -953,7 +954,8 @@ tracker_data_delete_statement (const gchar *subject,
/* delete rows from class tables */
delete_resource_type (subject_id, class);
} else {
- g_warning ("Class '%s' not found in the ontology", object);
+ g_set_error (error, TRACKER_DATA_ERROR, TRACKER_DATA_ERROR_UNKNOWN_CLASS,
+ "Class '%s' not found in the ontology", object);
}
} else {
field = tracker_ontology_get_property_by_uri (predicate);
@@ -980,7 +982,8 @@ tracker_data_delete_statement (const gchar *subject,
g_object_unref (stmt);
}
} else {
- g_warning ("Property '%s' not found in the ontology", predicate);
+ g_set_error (error, TRACKER_DATA_ERROR, TRACKER_DATA_ERROR_UNKNOWN_PROPERTY,
+ "Property '%s' not found in the ontology", predicate);
}
}
@@ -1212,7 +1215,7 @@ tracker_data_delete_resource (const gchar *uri)
{
g_return_if_fail (uri != NULL);
- tracker_data_delete_statement (uri, RDF_PREFIX "type", RDFS_PREFIX "Resource");
+ tracker_data_delete_statement (uri, RDF_PREFIX "type", RDFS_PREFIX "Resource", NULL);
}
static void
@@ -1586,7 +1589,7 @@ tracker_data_delete_resource_description (const gchar *uri)
object = get_string_for_value (&value);
g_value_unset (&value);
- tracker_data_delete_statement (uri, tracker_property_get_uri (*property), object);
+ tracker_data_delete_statement (uri, tracker_property_get_uri (*property), object, NULL);
g_free (object);
} else {
@@ -1617,7 +1620,7 @@ tracker_data_delete_resource_description (const gchar *uri)
object = get_string_for_value (&value);
g_value_unset (&value);
- tracker_data_delete_statement (uri, tracker_property_get_uri (*property), object);
+ tracker_data_delete_statement (uri, tracker_property_get_uri (*property), object, NULL);
g_free (object);
} while (tracker_db_result_set_iter_next (multi_result_set));
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index d9215b1..59d3ffa 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -49,7 +49,8 @@ gboolean tracker_data_update_resource_uri (const gchar *ol
void tracker_data_delete_resource_description (const gchar *uri);
void tracker_data_delete_statement (const gchar *subject,
const gchar *predicate,
- const gchar *object);
+ const gchar *object,
+ GError **error);
void tracker_data_insert_statement (const gchar *subject,
const gchar *predicate,
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 82ccdb5..a6838e3 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -438,7 +438,7 @@ tracker_store_delete_statement (const gchar *subject,
private->batch_count = 0;
}
- tracker_data_delete_statement (subject, predicate, object);
+ tracker_data_delete_statement (subject, predicate, object, NULL);
}
guint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]