[tracker/tracker-0.6] Fixes: NB#113528, Tracker indexer crashes after querying meta data of...



commit 3237ca3cec16665c45308b4f9329a1662887c266
Author: Martyn Russell <martyn imendio com>
Date:   Wed Apr 29 10:17:34 2009 +0100

    Fixes: NB#113528, Tracker indexer crashes after querying meta data of...
    
    Fixes: NB#113528, Error updating "Playlist:ValidDuration" property
---
 data/db/sqlite-service.sql               |    6 +++---
 src/libtracker-data/tracker-data-query.c |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/data/db/sqlite-service.sql b/data/db/sqlite-service.sql
index 2575886..049205b 100644
--- a/data/db/sqlite-service.sql
+++ b/data/db/sqlite-service.sql
@@ -16,9 +16,9 @@ CREATE TABLE  Services
 	KeyMetadata3		Text,
 	KeyMetadata4		Text,
 	KeyMetadata5		Text,
-	KeyMetadata6		Integer,
-	KeyMetadata7		Integer,
-	KeyMetadata8		Integer,
+	KeyMetadata6		Integer, /* NOTE: If you change the type of any of these KeyMetadata%d members, */
+	KeyMetadata7		Integer, /*       then you must update the source in: */
+	KeyMetadata8		Integer, /*       tracker_data_query_metadata_field_values(); */
 	KeyMetadata9		Text,
 	KeyMetadata10		Text,
 	KeyMetadata11		Text,
diff --git a/src/libtracker-data/tracker-data-query.c b/src/libtracker-data/tracker-data-query.c
index b88daca..48f6cb3 100644
--- a/src/libtracker-data/tracker-data-query.c
+++ b/src/libtracker-data/tracker-data-query.c
@@ -661,6 +661,22 @@ tracker_data_query_metadata_field_values (TrackerService *service_def,
 								 NULL,
 								 query,
 								 NULL);
+
+		/* NOTE: This is defined in data/db/sqlite-service.sql
+		 * and we are hard coding this here to avoid crashes
+		 * later down in this code where we expect ints to be
+		 * strings. 
+		 *
+		 * Yes, I know this is crack, but we are trying to get
+		 * something stable right now, it will all be fixed in
+		 * the next release! :P -mr
+		 */
+		if (metadata_key == 6 ||
+		    metadata_key == 7 ||
+		    metadata_key == 8) {
+			is_numeric = TRUE;
+		}
+
 		g_free (query);
 	} else {
 		gchar *id_str;



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