[tracker] libtracker-data: Check type only when updating existing resources



commit 13f202bd7f6ec69d2b95cfc1082ee45288cc7db7
Author: Jürg Billeter <j bitron ch>
Date:   Tue Aug 25 12:40:11 2009 +0200

    libtracker-data: Check type only when updating existing resources

 src/libtracker-data/tracker-data-update.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 8b42d30..f09f050 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1002,8 +1002,12 @@ tracker_data_insert_statement_common (const gchar            *subject,
 
 		/* subject not yet in cache, retrieve or create ID */
 		update_buffer.subject = g_strdup (subject);
-		update_buffer.id = ensure_resource_id (update_buffer.subject);
-		update_buffer.types = tracker_data_query_rdf_type (update_buffer.id);
+		update_buffer.id = query_resource_id (update_buffer.subject);
+		if (update_buffer.id == 0) {
+			update_buffer.id = ensure_resource_id (update_buffer.subject);
+		} else {
+			update_buffer.types = tracker_data_query_rdf_type (update_buffer.id);
+		}
 
 		g_value_set_int (&gvalue, tracker_data_update_get_next_modseq ());
 		cache_insert_value ("rdfs:Resource", "tracker:modified", &gvalue, FALSE, FALSE);



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