[tracker/store-memory] libtracker-data: Do not signal or journal unnecessary delete statements
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/store-memory] libtracker-data: Do not signal or journal unnecessary delete statements
- Date: Tue, 2 Mar 2010 12:29:48 +0000 (UTC)
commit 44426068a2ea1bca444a03639fbd4a1734fdc59b
Author: Jürg Billeter <j bitron ch>
Date: Tue Mar 2 13:28:59 2010 +0100
libtracker-data: Do not signal or journal unnecessary delete statements
src/libtracker-data/tracker-data-update.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index f3a5efd..f7d9559 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1186,7 +1186,7 @@ cache_set_metadata_decomposed (TrackerProperty *property,
return change;
}
-static void
+static gboolean
delete_metadata_decomposed (TrackerProperty *property,
const gchar *value,
GError **error)
@@ -1198,6 +1198,7 @@ delete_metadata_decomposed (TrackerProperty *property,
GValue gvalue = { 0 };
GValueArray *old_values;
GError *new_error = NULL;
+ gboolean change = FALSE;
multiple_values = tracker_property_get_multiple_values (property);
if (multiple_values) {
@@ -1216,7 +1217,7 @@ delete_metadata_decomposed (TrackerProperty *property,
if (new_error) {
g_free (table_name);
g_propagate_error (error, new_error);
- return;
+ return FALSE;
}
string_to_gvalue (value, tracker_property_get_data_type (property), &gvalue, &new_error);
@@ -1224,7 +1225,7 @@ delete_metadata_decomposed (TrackerProperty *property,
if (new_error) {
g_free (table_name);
g_propagate_error (error, new_error);
- return;
+ return FALSE;
}
if (!value_set_remove_value (old_values, &gvalue)) {
@@ -1233,6 +1234,8 @@ delete_metadata_decomposed (TrackerProperty *property,
} else {
cache_delete_value (table_name, field_name, &gvalue, multiple_values, fts,
tracker_property_get_data_type (property) == TRACKER_PROPERTY_TYPE_DATETIME);
+
+ change = TRUE;
}
g_free (table_name);
@@ -1243,6 +1246,8 @@ delete_metadata_decomposed (TrackerProperty *property,
delete_metadata_decomposed (*super_properties, value, error);
super_properties++;
}
+
+ return TRUE;
}
static void
@@ -1367,6 +1372,7 @@ tracker_data_delete_statement (const gchar *graph,
TrackerClass *class;
TrackerProperty *field;
gint subject_id;
+ gboolean change = FALSE;
g_return_if_fail (subject != NULL);
g_return_if_fail (predicate != NULL);
@@ -1417,8 +1423,10 @@ tracker_data_delete_statement (const gchar *graph,
} else {
field = tracker_ontologies_get_property_by_uri (predicate);
if (field != NULL) {
+ change = delete_metadata_decomposed (field, object, error);
+
gint id = tracker_property_get_id (field);
- if (!in_journal_replay) {
+ if (!in_journal_replay && change) {
if (tracker_property_get_data_type (field) == TRACKER_PROPERTY_TYPE_RESOURCE) {
tracker_db_journal_append_delete_statement_id (
(graph != NULL ? query_resource_id (graph) : 0),
@@ -1433,14 +1441,12 @@ tracker_data_delete_statement (const gchar *graph,
object);
}
}
-
- delete_metadata_decomposed (field, object, error);
} else {
g_set_error (error, TRACKER_DATA_ERROR, TRACKER_DATA_ERROR_UNKNOWN_PROPERTY,
"Property '%s' not found in the ontology", predicate);
}
- if (delete_callbacks) {
+ if (delete_callbacks && change) {
guint n;
for (n = 0; n < delete_callbacks->len; n++) {
TrackerStatementDelegate *delegate;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]