[tracker/rss-enclosures] libtracker-data: Restore all IDs from ontology journal



commit 8a0f25480972bda749f5265b3dda1368bbd19ca7
Author: Jürg Billeter <j bitron ch>
Date:   Tue Oct 12 11:26:06 2010 +0200

    libtracker-data: Restore all IDs from ontology journal

 src/libtracker-data/tracker-data-manager.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 28c5e0e..f8aea34 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1884,7 +1884,7 @@ insert_uri_in_resource_table (TrackerDBInterface *iface,
 	GError *error = NULL;
 
 	stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE, &error,
-	                                              "INSERT "
+	                                              "INSERT OR IGNORE "
 	                                              "INTO Resource "
 	                                              "(ID, Uri) "
 	                                              "VALUES (?, ?)");
@@ -2856,6 +2856,17 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 
 		tracker_data_ontology_import_into_db (FALSE);
 
+		if (uri_id_map) {
+			/* restore all IDs from ontology journal */
+			GHashTableIter iter;
+			gpointer key, value;
+
+			g_hash_table_iter_init (&iter, uri_id_map);
+			while (g_hash_table_iter_next (&iter, &key, &value)) {
+				insert_uri_in_resource_table (iface, key, GPOINTER_TO_INT (value));
+			}
+		}
+
 		/* store ontology in database */
 		for (l = sorted; l; l = l->next) {
 			gchar *ontology_path = g_build_filename (ontologies_dir, l->data, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]