[tracker] libtracker-data: Update rdf:type table when deleting type statements



commit bb637f802d68aff0eac2d0cb8f1f251085f3f7fd
Author: Jürg Billeter <j bitron ch>
Date:   Mon Jan 10 15:50:04 2011 +0100

    libtracker-data: Update rdf:type table when deleting type statements
    
    Fixes NB#217575.

 src/libtracker-data/tracker-data-update.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 6e46c5f..11a7b94 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1805,7 +1805,25 @@ cache_delete_resource_type (TrackerClass *class,
 	}
 
 	if (direct_delete) {
+		/* delete row from class table */
 		db_delete_row (iface, tracker_class_get_name (class), resource_buffer->id);
+
+		/* delete row from rdfs:Resource_rdf:type table */
+		stmt = tracker_db_interface_create_statement (iface, TRACKER_DB_STATEMENT_CACHE_TYPE_UPDATE, &error,
+			                                      "DELETE FROM \"rdfs:Resource_rdf:type\" WHERE ID = ? AND \"rdf:type\" = ?");
+
+		if (stmt) {
+			tracker_db_statement_bind_int (stmt, 0, resource_buffer->id);
+			tracker_db_statement_bind_int (stmt, 1, tracker_class_get_id (class));
+			tracker_db_statement_execute (stmt, &error);
+			g_object_unref (stmt);
+		}
+
+		if (error) {
+			g_warning ("%s", error->message);
+			g_error_free (error);
+			error = NULL;
+		}
 	} else {
 		cache_delete_row (class);
 	}



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