[tracker/property-changes] libtracker-data: Bugfix range change for multi-values



commit 1b32af5dbce51be24f079b242b8109339d93e829
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Apr 5 14:55:32 2010 +0200

    libtracker-data: Bugfix range change for multi-values

 src/libtracker-data/tracker-data-manager.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index e56ed38..e1c00dd 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1378,6 +1378,10 @@ create_decomposed_metadata_property_table (TrackerDBInterface *iface,
 			}
 
 			if (in_change && !tracker_property_get_is_new (property)) {
+				tracker_db_interface_execute_query (iface, NULL,
+				                                    "DROP INDEX IF EXISTS \"%s_%s_ID\"",
+				                                    service_name,
+				                                    field_name);
 				tracker_db_interface_execute_query (iface, &error,
 				                                    "ALTER TABLE \"%s_%s\" RENAME TO \"%s_%s_TEMP\"", 
 				                                    service_name, field_name, service_name, field_name);
@@ -1424,20 +1428,8 @@ create_decomposed_metadata_property_table (TrackerDBInterface *iface,
 				g_clear_error (&error);
 			}
 
-			/* multiple values */
-			if (tracker_property_get_indexed (property)) {
-				/* use different UNIQUE index for properties whose
-				 * value should be indexed to minimize index size */
-				set_index_for_multi_value_property (iface, service_name, field_name, TRUE);
-			} else {
-				set_index_for_multi_value_property (iface, service_name, field_name, FALSE);
-				/* we still have to include the property value in
-				 * the unique index for proper constraints */
-			}
-
 			g_string_free (sql, TRUE);
 
-
 			if (in_change && !tracker_property_get_is_new (property) && in_col_sql && sel_col_sql) {
 				gchar *query;
 
@@ -1469,6 +1461,17 @@ create_decomposed_metadata_property_table (TrackerDBInterface *iface,
 			if (in_col_sql)
 				g_string_free (in_col_sql, TRUE);
 
+			/* multiple values */
+			if (tracker_property_get_indexed (property)) {
+				/* use different UNIQUE index for properties whose
+				 * value should be indexed to minimize index size */
+				set_index_for_multi_value_property (iface, service_name, field_name, TRUE);
+			} else {
+				set_index_for_multi_value_property (iface, service_name, field_name, FALSE);
+				/* we still have to include the property value in
+				 * the unique index for proper constraints */
+			}
+
 		} else if (sql_type_for_single_value) {
 			*sql_type_for_single_value = sql_type;
 		}



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