[tracker/journal] Revert "libtracker-data: Reflow the code a bit in the journal replayer"
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/journal] Revert "libtracker-data: Reflow the code a bit in the journal replayer"
- Date: Mon, 25 Oct 2010 07:58:16 +0000 (UTC)
commit 31017a5821dc5eb427aba804241f384031fdbe0d
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Oct 25 09:57:51 2010 +0200
Revert "libtracker-data: Reflow the code a bit in the journal replayer"
This reverts commit f19d07f78c787309fde0dd4ab91f66d218d4b46a.
src/libtracker-data/tracker-data-update.c | 181 +++++++++++++++--------------
1 files changed, 93 insertions(+), 88 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 1816a3a..28110a1 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2730,7 +2730,10 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
iface = tracker_db_manager_get_db_interface ();
stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE, &new_error,
- "INSERT INTO Resource (ID, Uri) VALUES (?, ?)");
+ "INSERT "
+ "INTO Resource "
+ "(ID, Uri) "
+ "VALUES (?, ?)");
if (stmt) {
tracker_db_statement_bind_int (stmt, 0, id);
@@ -2757,6 +2760,7 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
}
} else if (type == TRACKER_DB_JOURNAL_INSERT_STATEMENT) {
GError *new_error = NULL;
+ TrackerProperty *property = NULL;
tracker_db_journal_reader_get_statement (&graph_id, &subject_id, &predicate_id, &object);
@@ -2771,24 +2775,27 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
uri = tracker_ontologies_get_uri_by_id (predicate_id);
if (uri) {
- TrackerProperty *property = NULL;
-
property = tracker_ontologies_get_property_by_uri (uri);
- if (property) {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+ }
- cache_set_metadata_decomposed (property, object, 0, NULL, graph_id, &new_error);
+ if (property) {
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id);
- if (new_error) {
- g_warning ("Journal replay error: '%s'", new_error->message);
- g_clear_error (&new_error);
- }
- } else {
- g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
+ cache_set_metadata_decomposed (property, object, 0, NULL, graph_id, &new_error);
+
+ if (new_error) {
+ g_warning ("Journal replay error: '%s'", new_error->message);
+ g_clear_error (&new_error);
}
+
+ } else {
+ g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
}
+
} else if (type == TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID) {
GError *new_error = NULL;
+ TrackerClass *class = NULL;
+ TrackerProperty *property = NULL;
tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
@@ -2803,45 +2810,44 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
uri = tracker_ontologies_get_uri_by_id (predicate_id);
if (uri) {
- TrackerProperty *property = NULL;
-
property = tracker_ontologies_get_property_by_uri (uri);
- if (property) {
- if (tracker_property_get_data_type (property) != TRACKER_PROPERTY_TYPE_RESOURCE) {
- g_warning ("Journal replay error: 'property with ID %d does not account URIs'", predicate_id);
- } else {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
-
- if (property == rdf_type) {
- uri = tracker_ontologies_get_uri_by_id (object_id);
- if (uri) {
- TrackerClass *class = NULL;
-
- class = tracker_ontologies_get_class_by_uri (uri);
- if (class) {
- cache_create_service_decomposed (class, NULL, graph_id);
- } else {
- g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
- }
- }
+ }
+
+ if (property) {
+ if (tracker_property_get_data_type (property) != TRACKER_PROPERTY_TYPE_RESOURCE) {
+ g_warning ("Journal replay error: 'property with ID %d does not account URIs'", predicate_id);
+ } else {
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+
+ if (property == rdf_type) {
+ uri = tracker_ontologies_get_uri_by_id (object_id);
+ if (uri) {
+ class = tracker_ontologies_get_class_by_uri (uri);
+ }
+ if (class) {
+ cache_create_service_decomposed (class, NULL, graph_id);
} else {
- GError *new_error = NULL;
+ g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
+ }
+ } else {
+ GError *new_error = NULL;
- /* add value to metadata database */
- cache_set_metadata_decomposed (property, NULL, object_id, NULL, graph_id, &new_error);
+ /* add value to metadata database */
+ cache_set_metadata_decomposed (property, NULL, object_id, NULL, graph_id, &new_error);
- if (new_error) {
- g_warning ("Journal replay error: '%s'", new_error->message);
- g_error_free (new_error);
- }
+ if (new_error) {
+ g_warning ("Journal replay error: '%s'", new_error->message);
+ g_error_free (new_error);
}
}
- } else {
- g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
}
+ } else {
+ g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
}
+
} else if (type == TRACKER_DB_JOURNAL_DELETE_STATEMENT) {
GError *new_error = NULL;
+ TrackerProperty *property = NULL;
tracker_db_journal_reader_get_statement (&graph_id, &subject_id, &predicate_id, &object);
@@ -2858,41 +2864,41 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
uri = tracker_ontologies_get_uri_by_id (predicate_id);
if (uri) {
- TrackerProperty *property = NULL;
-
property = tracker_ontologies_get_property_by_uri (uri);
+ }
- if (property) {
- GError *new_error = NULL;
-
- if (object && rdf_type == property) {
+ if (property) {
+ GError *new_error = NULL;
- uri = tracker_ontologies_get_uri_by_id (object_id);
- if (uri) {
- TrackerClass *class = NULL;
+ if (object && rdf_type == property) {
+ TrackerClass *class = NULL;
- class = tracker_ontologies_get_class_by_uri (uri);
- if (class != NULL) {
- cache_delete_resource_type (class, NULL, graph_id);
- } else {
- g_warning ("Journal replay error: 'class with '%s' not found in the ontology'", object);
- }
- }
- } else {
- delete_metadata_decomposed (property, object, 0, &new_error);
+ uri = tracker_ontologies_get_uri_by_id (object_id);
+ if (uri) {
+ class = tracker_ontologies_get_class_by_uri (uri);
}
-
- if (new_error) {
- g_warning ("Journal replay error: '%s'", new_error->message);
- g_error_free (new_error);
+ if (class != NULL) {
+ cache_delete_resource_type (class, NULL, graph_id);
+ } else {
+ g_warning ("Journal replay error: 'class with '%s' not found in the ontology'", object);
}
-
} else {
- g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
+ delete_metadata_decomposed (property, object, 0, &new_error);
}
+
+ if (new_error) {
+ g_warning ("Journal replay error: '%s'", new_error->message);
+ g_error_free (new_error);
+ }
+
+ } else {
+ g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
}
+
} else if (type == TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID) {
GError *new_error = NULL;
+ TrackerClass *class = NULL;
+ TrackerProperty *property = NULL;
tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
@@ -2907,36 +2913,35 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
uri = tracker_ontologies_get_uri_by_id (predicate_id);
if (uri) {
- TrackerProperty *property = NULL;
-
property = tracker_ontologies_get_property_by_uri (uri);
- if (property) {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
- if (property == rdf_type) {
- uri = tracker_ontologies_get_uri_by_id (object_id);
- if (uri) {
- TrackerClass *class = NULL;
+ }
- class = tracker_ontologies_get_class_by_uri (uri);
- if (class) {
- cache_delete_resource_type (class, NULL, graph_id);
- } else {
- g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
- }
- }
- } else {
- GError *new_error = NULL;
+ if (property) {
- delete_metadata_decomposed (property, NULL, object_id, &new_error);
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id);
- if (new_error) {
- g_warning ("Journal replay error: '%s'", new_error->message);
- g_error_free (new_error);
- }
+ if (property == rdf_type) {
+ uri = tracker_ontologies_get_uri_by_id (object_id);
+ if (uri) {
+ class = tracker_ontologies_get_class_by_uri (uri);
+ }
+ if (class) {
+ cache_delete_resource_type (class, NULL, graph_id);
+ } else {
+ g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
}
} else {
- g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
+ GError *new_error = NULL;
+
+ delete_metadata_decomposed (property, NULL, object_id, &new_error);
+
+ if (new_error) {
+ g_warning ("Journal replay error: '%s'", new_error->message);
+ g_error_free (new_error);
+ }
}
+ } else {
+ g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]