anjuta r4500 - in trunk: . plugins/symbol-db



Author: mcora
Date: Sun Dec 28 15:25:05 2008
New Revision: 4500
URL: http://svn.gnome.org/viewvc/anjuta?rev=4500&view=rev

Log:
	* plugins/symbol-db/symbol-db-engine-core.c
	(sdb_engine_free_cached_queries), (sdb_engine_normalize_sym_type),
	(symbol_db_engine_open_db), (sdb_engine_detects_removed_ids):
	* plugins/symbol-db/tables.sql:
	fixed #565769 â symbol-db blocks anjuta when files are removed.
	Removed a trigger when ON DELETE is called. This should speed up the things.
	The 'delete from sym_type' will take place on connection opening.
	A complete repopulation is needed to see such fix working, 
	e.g. `rm .anjuta_sym_db.db`

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-db/symbol-db-engine-core.c
   trunk/plugins/symbol-db/tables.sql

Modified: trunk/plugins/symbol-db/symbol-db-engine-core.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-core.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-core.c	Sun Dec 28 15:25:05 2008
@@ -603,7 +603,6 @@
 
 	for (i = 0; i < PREP_QUERY_COUNT; i++)
 	{
-/*DEBUG_PRINT ("sdb_engine_free_cached_queries START %d", i);*/
 		node = priv->static_query_list[i];
 
 		if (node != NULL && node->stmt != NULL)
@@ -623,7 +622,6 @@
 		/* last but not the least free the node itself */
 		g_free (node);
 		priv->static_query_list[i] = NULL;
-/*DEBUG_PRINT ("sdb_engine_free_cached_queries END %d", i);		*/
 	}
 }
 
@@ -2583,6 +2581,16 @@
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA case_sensitive_like = 1");
 }
 
+/**
+ * Delete all entries that don't have a reference on symbol table.
+ */
+static void
+sdb_engine_normalize_sym_type (SymbolDBEngine * dbe)
+{	
+	sdb_engine_execute_unknown_sql (dbe, "DELETE FROM sym_type WHERE type_id NOT IN "
+		"(SELECT type_id FROM symbol)");
+}
+
 /* Will create priv->db_connection.
  * Connect to database identified by db_directory.
  * Usually db_directory is defined also into priv. We let it here as parameter 
@@ -2800,7 +2808,10 @@
 	}
 
 	sdb_engine_set_defaults_db_parameters (dbe);
-	
+
+	/* normalize some tables */
+	sdb_engine_normalize_sym_type (dbe);
+		
 	return TRUE;
 }
 
@@ -4963,7 +4974,7 @@
 	{
 		if ((num_rows = gda_data_model_get_n_rows (data_model)) <= 0)
 		{
-			DEBUG_PRINT ("%s", "sdb_engine_detects_removed_ids (): nothing to remove");
+			DEBUG_PRINT ("nothing to remove");
 			g_object_unref (data_model);
 			return;
 		}
@@ -4983,7 +4994,7 @@
 		val = gda_data_model_get_value_at (data_model, 0, i, NULL);
 		tmp = g_value_get_int (val);
 	
-		DEBUG_PRINT ("%s", "EMITTING symbol-removed");
+		/*DEBUG_PRINT ("%s", "EMITTING symbol-removed");*/
 		g_async_queue_push (priv->signals_queue, GINT_TO_POINTER(SYMBOL_REMOVED + 1));
 		g_async_queue_push (priv->signals_queue, GINT_TO_POINTER(tmp));
 	}

Modified: trunk/plugins/symbol-db/tables.sql
==============================================================================
--- trunk/plugins/symbol-db/tables.sql	(original)
+++ trunk/plugins/symbol-db/tables.sql	Sun Dec 28 15:25:05 2008
@@ -124,8 +124,6 @@
 FOR EACH ROW
 BEGIN
     DELETE FROM scope WHERE scope.scope_id=old.scope_definition_id;
-    DELETE FROM sym_type WHERE sym_type.type_id=old.type_id AND (SELECT COUNT(*) 
-					FROM symbol WHERE symbol.type_id=old.type_id) <= 1;
     UPDATE symbol SET scope_id='-1' WHERE symbol.scope_id=old.scope_definition_id AND symbol.scope_id > 0;
     INSERT INTO __tmp_removed (symbol_removed_id) VALUES (old.symbol_id);
 END;



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