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



Author: mcora
Date: Fri Jan 16 21:11:51 2009
New Revision: 4596
URL: http://svn.gnome.org/viewvc/anjuta?rev=4596&view=rev

Log:
	* plugins/symbol-db/plugin.c (goto_file_tag):
	* plugins/symbol-db/symbol-db-engine-core.c
	(sdb_engine_execute_unknown_sql), (sdb_engine_ctags_output_thread),
	(sdb_engine_set_defaults_db_parameters),
	(symbol_db_engine_file_exists), (sdb_engine_get_unique_scan_id),
	(sdb_engine_add_new_symbol), (sdb_engine_update_file),
	(on_scan_update_files_symbols_end),
	(symbol_db_engine_update_project_symbols),
	(symbol_db_engine_remove_file),
	(symbol_db_engine_set_db_case_sensitive):
	* plugins/symbol-db/symbol-db-engine-core.h:
	* plugins/symbol-db/symbol-db-engine-priv.h:
	* plugins/symbol-db/symbol-db-engine-queries.c
	(symbol_db_engine_get_class_parents_by_symbol_id),
	(symbol_db_engine_get_class_parents),
	(symbol_db_engine_get_global_members_filtered),
	(symbol_db_engine_get_scope_members_by_symbol_id_filtered),
	(symbol_db_engine_get_scope_members_by_symbol_id),
	(symbol_db_engine_get_scope_members),
	(symbol_db_engine_get_current_scope),
	(symbol_db_engine_get_file_symbols),
	(symbol_db_engine_get_symbol_info_by_id),
	(symbol_db_engine_find_symbol_by_name_pattern),
	(symbol_db_engine_get_parent_scope_id_by_symbol_id),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered),
	(symbol_db_engine_get_files_for_project),
	(symbol_db_engine_get_languages_count),
	(symbol_db_engine_is_language_used):
	* plugins/symbol-db/symbol-db-engine-queries.h:
	* plugins/symbol-db/symbol-db-view-search.c
	(sdb_view_search_model_filter):
	fixed #567060 â symbol search should ignore case.
	Added some macros to manage mutex_lock ().

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/symbol-db-engine-core.c
   trunk/plugins/symbol-db/symbol-db-engine-core.h
   trunk/plugins/symbol-db/symbol-db-engine-priv.h
   trunk/plugins/symbol-db/symbol-db-engine-queries.c
   trunk/plugins/symbol-db/symbol-db-engine-queries.h
   trunk/plugins/symbol-db/symbol-db-view-search.c

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Fri Jan 16 21:11:51 2009
@@ -160,6 +160,7 @@
 	
 	iterator = symbol_db_engine_find_symbol_by_name_pattern (sdb_plugin->sdbe_project, 
 															 word,
+															 TRUE,
 															 SYMINFO_SIMPLE |
 											   				 SYMINFO_KIND |
 															 SYMINFO_FILE_PATH);

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	Fri Jan 16 21:11:51 2009
@@ -295,6 +295,7 @@
 											NULL);	
 }
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
 static gboolean 
 sdb_engine_execute_unknown_sql (SymbolDBEngine *dbe, const gchar *sql)
 {
@@ -304,10 +305,14 @@
 	
 	priv = dbe->priv;	
 	
+	SDB_LOCK(priv);
 	stmt = gda_sql_parser_parse_string (priv->sql_parser, sql, NULL, NULL);	
 
 	if (stmt == NULL)
+	{
+		SDB_UNLOCK(priv);
 		return FALSE;
+	}
 	
     if ((res = gda_connection_statement_execute (priv->db_connection, 
 												   (GdaStatement*)stmt, 
@@ -316,13 +321,15 @@
 													NULL, NULL)) == NULL)
 	{
 		g_object_unref (stmt);
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	else 
 	{
 		g_object_unref (res);
 		g_object_unref (stmt);
-		return TRUE;		
+		SDB_UNLOCK(priv);
+		return TRUE;
 	}
 }
 
@@ -386,6 +393,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * Use a proxy to return an already present or a fresh new prepared query 
  * from static 'query_list'. We should perform actions in the fastest way, because
  * these queries are time-critical.
@@ -595,6 +604,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * Return a GdaSet of parameters calculated from the statement. It does not check
  * if it's null. You *must* be sure to have called sdb_engine_get_statement_by_query_id () first.
  */
@@ -702,6 +713,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * @return -1 on error. Otherwise the id of tuple.
  */
 inline gint
@@ -771,6 +784,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * This is the same as sdb_engine_get_tuple_id_by_unique_name () but for two
  * unique parameters. This should be the quickest way. Surely quicker than
  * use g_strdup_printf () with a va_list for example.
@@ -871,6 +886,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static inline gint
 sdb_engine_get_tuple_id_by_unique_name3 (SymbolDBEngine * dbe, 
 										 static_query_type qtype,
@@ -987,6 +1003,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static inline gint
 sdb_engine_get_tuple_id_by_unique_name4 (SymbolDBEngine * dbe, 
 										 static_query_type qtype,
@@ -1125,6 +1142,7 @@
 	return table_id;
 }
 
+/** ### Thread note: this function inherits the mutex lock ### */
 static int
 sdb_engine_get_file_defined_id (SymbolDBEngine* dbe,
 								const gchar* base_prj_path,
@@ -1175,6 +1193,7 @@
 	return file_defined_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static
 gboolean sdb_engine_udpated_scope_gtree_populate (gpointer key,
                                                   gpointer value,
@@ -1207,6 +1226,8 @@
 static gdouble elapsed_total_DEBUG = 0;
 
 /**
+ * ### Thread note: this function inherits the mutex lock ###
+ *
  * If fake_file is != NULL we claim and assert that tags contents which are
  * scanned belong to the fake_file in the project.
  * More: the fake_file refers to just one single file and cannot be used
@@ -1305,6 +1326,7 @@
 	/* we've done with tag_file but we don't need to tagsClose (tag_file); */
 }
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
 static void
 sdb_engine_ctags_output_thread (gpointer data, gpointer user_data)
 {
@@ -1323,9 +1345,7 @@
 
 	priv = dbe->priv;
 
-	/* lock */
-	if (priv->mutex)
-		g_mutex_lock (priv->mutex);
+	SDB_LOCK(priv);
 	
 	remaining_chars = len_chars = strlen (chars_ptr);
 	len_marker = strlen (CTAGS_MARKER);	
@@ -1470,9 +1490,7 @@
 		DEBUG_PRINT ("%s", "no len_chars > len_marker");
 	}
 	
-	/* unlock */
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	
 	g_free (chars);
 }
@@ -2697,10 +2715,10 @@
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA page_size = 32768");
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA cache_size = 12288");
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA synchronous = OFF");
-	sdb_engine_execute_unknown_sql (dbe, "PRAGMA temp_store = MEMORY");
-	sdb_engine_execute_unknown_sql (dbe, "PRAGMA case_sensitive_like = 1");
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA temp_store = MEMORY");	
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA journal_mode = OFF");
 	sdb_engine_execute_unknown_sql (dbe, "PRAGMA read_uncommitted = 1");
+	symbol_db_engine_set_db_case_sensitive (dbe, TRUE);
 }
 
 /**
@@ -2837,6 +2855,7 @@
 	return TRUE;
 }
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
 gboolean
 symbol_db_engine_file_exists (SymbolDBEngine * dbe, const gchar * abs_file_path)
 {
@@ -2850,16 +2869,12 @@
 	
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	relative = symbol_db_engine_get_file_db_path (dbe, abs_file_path);
 	if (relative == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}	
 	MP_LEND_OBJ_STR(priv, value);	
@@ -2871,14 +2886,12 @@
 													value)) < 0)
 	{	
 		g_free (relative);
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return FALSE;	
 	}
 	
 	g_free (relative);
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return TRUE;	
 }
 
@@ -3336,6 +3349,7 @@
 	return TRUE;
 } 
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
 static gint 
 sdb_engine_get_unique_scan_id (SymbolDBEngine * dbe)
 {
@@ -3344,8 +3358,7 @@
 	
 	priv = dbe->priv;
 	
-	if (priv->mutex)
-		g_mutex_lock (priv->mutex);
+	SDB_LOCK(priv);
 	
 	priv->scan_process_id++;	
 	ret_id = priv->scan_process_id;
@@ -3354,8 +3367,7 @@
 	g_async_queue_push (priv->scan_process_id_queue, 
 						GINT_TO_POINTER(priv->scan_process_id));
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return ret_id;
 }
 	
@@ -3434,6 +3446,7 @@
 	return ret_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static inline gint
 sdb_engine_add_new_sym_type (SymbolDBEngine * dbe, const tagEntry * tag_entry)
 {
@@ -3524,6 +3537,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static gint
 sdb_engine_add_new_sym_kind (SymbolDBEngine * dbe, const tagEntry * tag_entry)
 {
@@ -3608,6 +3622,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static gint
 sdb_engine_add_new_sym_access (SymbolDBEngine * dbe, const tagEntry * tag_entry)
 {
@@ -3696,6 +3711,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static gint
 sdb_engine_add_new_sym_implementation (SymbolDBEngine * dbe,
 									   const tagEntry * tag_entry)
@@ -3782,6 +3798,7 @@
 	return table_id;
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static void
 sdb_engine_add_new_heritage (SymbolDBEngine * dbe, gint base_symbol_id,
 							 gint derived_symbol_id)
@@ -3842,6 +3859,7 @@
 	}	
 }
 
+/* ### Thread note: this function inherits the mutex lock ### */
 static inline gint
 sdb_engine_add_new_scope_definition (SymbolDBEngine * dbe, const tagEntry * tag_entry,
 									 gint type_table_id)
@@ -3945,6 +3963,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * Saves the tagEntry info for a second pass parsing.
  * Usually we don't know all the symbol at the first scan of the tags. We need
  * a second one. These tuples are created for that purpose.
@@ -4143,7 +4163,11 @@
 	return table_id;
 }
 
-/** Return the symbol_id of the changed symbol */
+/** 
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
+ * Return the symbol_id of the changed symbol 
+ */
 static inline gint
 sdb_engine_second_pass_update_scope_1 (SymbolDBEngine * dbe,
 									   GdaDataModel * data, gint data_row,
@@ -4272,6 +4296,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * @param data Must be filled with some values. It must have num_rows > 0
  * @note *CALL THIS BEFORE second_pass_update_heritage ()*
  * @note *DO NOT FREE data* inside this function.
@@ -4360,6 +4386,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * @param data Must be filled with some values. It must have num_rows > 0
  * @note *CALL THIS AFTER second_pass_update_scope ()*
  */
@@ -4532,6 +4560,8 @@
 }
 
 /**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
  * Process the temporary table to update the symbols on scope and inheritance 
  * fields.
  * *CALL THIS FUNCTION ONLY AFTER HAVING PARSED ALL THE TAGS ONCE*
@@ -4624,7 +4654,10 @@
 														  NULL, NULL, NULL);	
 }
 
-/* base_prj_path can be NULL. In that case path info tag_entry will be taken
+/**
+ * ### Thread note: this function inherits the mutex lock ### 
+ *
+ * base_prj_path can be NULL. In that case path info tag_entry will be taken
  * as an absolute path.
  * fake_file can be used when a buffer updating is being executed. In that 
  * particular case both base_prj_path and tag_entry->file will be ignored. 
@@ -4673,7 +4706,6 @@
 	gint update_flag;
 	GValue *ret_value;
 	gboolean ret_bool;
-	GTimer* timer = g_timer_new();
 		
 	g_return_val_if_fail (dbe != NULL, -1);
 	priv = dbe->priv;
@@ -4702,28 +4734,24 @@
 
 	type_id = sdb_engine_add_new_sym_type (dbe, tag_entry);
 
-	/*DEBUG_PRINT ("add_symbol type_id: %f", g_timer_elapsed (timer, NULL));*/
 	/* scope_definition_id tells what scope this symbol defines
 	 * this call *MUST BE DONE AFTER* sym_type table population.
 	 */
 	scope_definition_id = sdb_engine_add_new_scope_definition (dbe, tag_entry,
 															   type_id);
 
-	/*DEBUG_PRINT ("add_symbol scope_definition_id: %f", g_timer_elapsed (timer, NULL));*/
 	/* the container scopes can be: union, struct, typeref, class, namespace etc.
 	 * this field will be parse in the second pass.
 	 */
 	scope_id = 0;
 
 	kind_id = sdb_engine_add_new_sym_kind (dbe, tag_entry);
-	/*DEBUG_PRINT ("add_symbol kind_id: %f", g_timer_elapsed (timer, NULL));*/
 	
 	access_kind_id = sdb_engine_add_new_sym_access (dbe, tag_entry);
-	/*DEBUG_PRINT ("add_symbol access_kind_id: %f", g_timer_elapsed (timer, NULL));*/
+	
 	implementation_kind_id =
 		sdb_engine_add_new_sym_implementation (dbe, tag_entry);
-	/*DEBUG_PRINT ("add_symbol implementation_kind_id: %f", g_timer_elapsed (timer, NULL));*/
-	/*DEBUG_PRINT ("add_symbol ids: %f", g_timer_elapsed (timer, NULL));*/
+	
 	/* ok: was the symbol updated [at least on it's type_id/name]? 
 	 * There are 3 cases:
 	 * #1. The symbol remain the same [at least on unique index key]. We will 
@@ -4866,7 +4894,7 @@
 
 		MP_SET_HOLDER_BATCH_INT(priv, param, symbol_id, ret_bool, ret_value);
 	}
-	/*DEBUG_PRINT ("add_symbol init: %f", g_timer_elapsed (timer, NULL));*/
+
 	/* common params */
 
 	/* fileposition parameter */
@@ -4950,15 +4978,12 @@
 	
 	MP_SET_HOLDER_BATCH_INT(priv, param, update_flag, ret_bool, ret_value);
 	
-	/*DEBUG_PRINT ("add_symbol batch: %f", g_timer_elapsed (timer, NULL));*/
-	
 	/* execute the query with parametes just set */
 	gint nrows;
 	nrows = gda_connection_statement_execute_non_select (priv->db_connection, 
 													 (GdaStatement*)stmt, 
 													 (GdaSet*)plist, &last_inserted,
 													 NULL);
-	/*DEBUG_PRINT ("add_symbol query: %f", g_timer_elapsed (timer, NULL));*/
 
 	if (sym_was_updated == FALSE)
 	{
@@ -5002,8 +5027,6 @@
 	if (table_id > 0)
 		sdb_engine_add_new_tmp_heritage_scope (dbe, tag_entry, table_id);
 
-	/*DEBUG_PRINT ("add_symbol end: %f", g_timer_elapsed (timer, NULL));*/
-	g_timer_destroy (timer);
 	return table_id;
 }
 
@@ -5083,6 +5106,8 @@
 }
 
 /**
+ * ~~~ Thread note: this function locks the mutex ~~~ *
+ *
  * WARNING: do not use this function thinking that it would do a scan of symbols
  * too. Use symbol_db_engine_update_files_symbols () instead. This one will set
  * up some things on db, like removing the 'old' symbols which have not been 
@@ -5100,6 +5125,8 @@
 
 	priv = dbe->priv;
 
+	SDB_LOCK(priv);
+	
 	/* if we're updating symbols we must do some other operations on db 
 	 * symbols, like remove the ones which don't have an update_flag = 1 
 	 * per updated file.
@@ -5115,6 +5142,8 @@
 									PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS)) == NULL)
 	{
 		g_warning ("query is null");
+		SDB_UNLOCK(priv);
+		
 		return FALSE;
 	}
 
@@ -5123,6 +5152,7 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist1, "filepath")) == NULL)
 	{
 		g_warning ("param filepath is NULL from pquery!");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5139,6 +5169,7 @@
 									PREP_QUERY_RESET_UPDATE_FLAG_SYMBOLS)) == NULL)
 	{
 		g_warning ("query is null");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5161,6 +5192,7 @@
 		== NULL)
 	{
 		g_warning ("query is null");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 
@@ -5170,6 +5202,7 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist3, "filepath")) == NULL)
 	{
 		g_warning ("param filepath is NULL from pquery!");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5177,6 +5210,7 @@
 
 	gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt3, 
 														 (GdaSet*)plist3, NULL, NULL);	
+	SDB_UNLOCK(priv);
 	return TRUE;
 }
 
@@ -5244,12 +5278,14 @@
 		const GdaStatement *stmt;
 		GdaHolder *param;
 
+		SDB_LOCK(priv);
 		/* and the project analyse_time */
 		if ((stmt = sdb_engine_get_statement_by_query_id (dbe,
 									PREP_QUERY_UPDATE_PROJECT_ANALYSE_TIME))
 			== NULL)
 		{
 			g_warning ("query is null");
+			SDB_UNLOCK(priv);
 			return;
 		}
 
@@ -5259,6 +5295,7 @@
 		if ((param = gda_set_get_holder ((GdaSet*)plist, "prjname")) == NULL)
 		{
 			g_warning ("param prjname is NULL from pquery!");
+			SDB_UNLOCK(priv);
 			return;
 		}
 		
@@ -5267,6 +5304,7 @@
 		gda_connection_statement_execute_non_select (priv->db_connection, 
 													 (GdaStatement*)stmt, 
 													 (GdaSet*)plist, NULL, NULL);
+		SDB_UNLOCK(priv);
 	}	
 	
 	/* free the GPtrArray. */
@@ -5480,7 +5518,10 @@
 	return ret_id;
 }
 
-/* Update symbols of the whole project. It scans all file symbols etc. 
+/**
+ * ~~~ Thread note: this function locks the mutex ~~~ *
+ *
+ * Update symbols of the whole project. It scans all file symbols etc. 
  * FIXME: libgda does not support nested prepared queries like 
  * PREP_QUERY_GET_ALL_FROM_FILE_BY_PROJECT_NAME. When it will do please
  * remember to update this function.
@@ -5508,6 +5549,7 @@
 	g_return_val_if_fail (project != NULL, FALSE);
 	g_return_val_if_fail (priv->project_directory != NULL, FALSE);
 	
+	SDB_LOCK(priv);
 
 	MP_LEND_OBJ_STR(priv, value);	
 	g_value_set_static_string (value, project);
@@ -5518,6 +5560,8 @@
 									 "prjname",
 									 value)) <= 0)
 	{
+		SDB_UNLOCK(priv);
+
 		return FALSE;
 	}
 
@@ -5526,6 +5570,8 @@
 		== NULL)
 	{
 		g_warning ("query is null");
+		SDB_UNLOCK(priv);
+
 		return FALSE;
 	}
 
@@ -5536,6 +5582,8 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist, "prjid")) == NULL)
 	{
 		g_warning ("param prjid is NULL from pquery!");
+		SDB_UNLOCK(priv);
+		
 		return FALSE;
 	}
 	
@@ -5661,13 +5709,19 @@
 	
 	if (files_to_scan->len > 0)
 	{
+		SDB_UNLOCK(priv);
+		
 		/* at the end let the scanning function do its job */
 		return symbol_db_engine_update_files_symbols (dbe, project,
 											   files_to_scan, TRUE);
 	}
+	
+	SDB_UNLOCK(priv);
+	
 	return -1;
 }
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
 gboolean
 symbol_db_engine_remove_file (SymbolDBEngine * dbe, const gchar * project,
 							  const gchar * abs_file)
@@ -5685,9 +5739,12 @@
 	g_return_val_if_fail (abs_file != NULL, FALSE);
 	priv = dbe->priv;
 	
+	SDB_LOCK(priv);
+
 	if (strlen (abs_file) < strlen (priv->project_directory)) 
 	{
 		g_warning ("wrong file to delete.");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5697,6 +5754,7 @@
 									PREP_QUERY_REMOVE_FILE_BY_PROJECT_NAME)) == NULL)
 	{
 		g_warning ("query is null");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 
@@ -5705,6 +5763,7 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist, "prjname")) == NULL)
 	{
 		g_warning ("param prjname is NULL from pquery!");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5713,6 +5772,7 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist, "filepath")) == NULL)
 	{
 		g_warning ("param filepath is NULL from pquery!");
+		SDB_UNLOCK(priv);
 		return FALSE;
 	}
 	
@@ -5729,6 +5789,8 @@
 	sdb_engine_detects_removed_ids (dbe);
 	
 	g_free (file_on_db);
+	SDB_UNLOCK(priv);
+	
 	return TRUE;
 }
 
@@ -5928,3 +5990,17 @@
 	return ret_id;
 }
 
+/* ~~~ Thread note: this function locks the mutex ~~~ */ 
+void
+symbol_db_engine_set_db_case_sensitive (SymbolDBEngine *dbe, gboolean case_sensitive)
+{
+	SymbolDBEnginePriv *priv;
+	
+	g_return_if_fail (dbe != NULL);
+	priv = dbe->priv;
+
+	if (case_sensitive == TRUE)
+		sdb_engine_execute_unknown_sql (dbe, "PRAGMA case_sensitive_like = 1");
+	else 
+		sdb_engine_execute_unknown_sql (dbe, "PRAGMA case_sensitive_like = 0");
+}

Modified: trunk/plugins/symbol-db/symbol-db-engine-core.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-core.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-core.h	Fri Jan 16 21:11:51 2009
@@ -225,7 +225,12 @@
 										const GPtrArray * text_buffers,
 										const GPtrArray * buffer_sizes);
 
-
+/**
+ * Set the opened db case sensitive. The searches on this db will then be performed
+ * taking into consideration this SQLite's PRAGMA case_sensitive_like.
+ */
+void
+symbol_db_engine_set_db_case_sensitive (SymbolDBEngine *dbe, gboolean case_sensitive);
 
 
 G_END_DECLS

Modified: trunk/plugins/symbol-db/symbol-db-engine-priv.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-priv.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-priv.h	Fri Jan 16 21:11:51 2009
@@ -107,6 +107,8 @@
 	} \
 }
 
+#define SDB_LOCK(priv) if (priv->mutex) g_mutex_lock (priv->mutex);
+#define SDB_UNLOCK(priv) if (priv->mutex) g_mutex_unlock (priv->mutex);
 
 typedef enum
 {

Modified: trunk/plugins/symbol-db/symbol-db-engine-queries.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-queries.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-queries.c	Fri Jan 16 21:11:51 2009
@@ -312,10 +312,7 @@
 	g_return_val_if_fail (dbe != NULL, FALSE);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 
 	if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe, 
 					DYN_PREP_QUERY_GET_CLASS_PARENTS_BY_SYMBOL_ID, sym_info, 0)) == NULL)
@@ -352,8 +349,7 @@
 
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -362,8 +358,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "childklassid")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -380,13 +375,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -419,10 +412,7 @@
 	g_return_val_if_fail (dbe != NULL, FALSE);
 	priv = dbe->priv;
 	
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	final_definition_id = -1;
 	if (scope_path != NULL)	
@@ -494,15 +484,13 @@
 	
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "klassname")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -512,8 +500,7 @@
 	{
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "defid")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 		
@@ -531,13 +518,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);
@@ -589,10 +574,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	/* check for an already flagged sym_info with KIND. SYMINFO_KIND on sym_info
 	 * is already contained into the default query infos.
@@ -745,8 +727,7 @@
 	
 	if (dyn_node == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -754,8 +735,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -766,8 +746,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -804,13 +783,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -865,15 +842,11 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	if (scope_parent_symbol_id <= 0)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -993,8 +966,7 @@
 
 	if (dyn_node == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}	
 	
@@ -1002,8 +974,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -1014,8 +985,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -1041,8 +1011,7 @@
 
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "scopeparentsymid")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1059,13 +1028,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1107,15 +1074,11 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	if (scope_parent_symbol_id <= 0)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1183,8 +1146,7 @@
 
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1193,8 +1155,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -1205,8 +1166,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -1215,8 +1175,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "scopeparentsymid")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1237,13 +1196,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1293,17 +1250,13 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);	
-	}
+	SDB_LOCK(priv);
 	
 	final_definition_id = sdb_engine_walk_down_scope_path (dbe, scope_path);
 	
 	if (final_definition_id <= 0) 
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1340,15 +1293,13 @@
 
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}	
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "defid")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1365,14 +1316,12 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1407,10 +1356,7 @@
 	DEBUG_PRINT ("db_relative_file  %s", db_relative_file);
 	DEBUG_PRINT ("full_local_file_path %s", full_local_file_path);
 	
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 
 	sym_info = sym_info & ~SYMINFO_FILE_PATH;
 	
@@ -1451,16 +1397,14 @@
 	
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		g_free (db_relative_file);
 		return NULL;
 	}
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "linenum")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		g_free (db_relative_file);
 		return NULL;
 	}
@@ -1469,8 +1413,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filepath")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		g_free (db_relative_file);
 		return NULL;
 	}
@@ -1488,14 +1431,12 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		g_free (db_relative_file);
 		return NULL;
 	}
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	
 	g_free (db_relative_file);
 	
@@ -1527,10 +1468,8 @@
 	priv = dbe->priv;	
 	g_return_val_if_fail (priv->db_directory != NULL, NULL);
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
+	
 	/* check for an already flagged sym_info with FILE_PATH. SYMINFO_FILE_PATH on 
 	 * sym_info is already contained into the default query infos.
 	 */
@@ -1574,8 +1513,7 @@
 
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -1584,16 +1522,14 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filepath")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 		
 	gchar *relative_path = symbol_db_engine_get_file_db_path (dbe, file_path);
 	if (relative_path == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -1610,15 +1546,13 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
 	g_free (relative_path);
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1642,10 +1576,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 
 	if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe, 
 		DYN_PREP_QUERY_GET_SYMBOL_INFO_BY_ID, sym_info, 0)) == NULL)
@@ -1680,8 +1611,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "symid")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -1698,13 +1628,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1715,7 +1643,8 @@
 
 SymbolDBEngineIterator *
 symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe, 
-									const gchar *pattern, SymExtraInfo sym_info)
+									const gchar *pattern, gboolean case_sensitive,
+									SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	gchar *query_str;	
@@ -1732,10 +1661,11 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	/* the function uses a mutex lock, so call it before locking this one */
+	if (case_sensitive == FALSE)
+		symbol_db_engine_set_db_case_sensitive (dbe, FALSE);
+	
+	SDB_LOCK(priv);
 
 	other_parameters = 0;
 	
@@ -1785,15 +1715,13 @@
 
 	if (dyn_node == NULL) 
 	{		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "pattern")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -1810,13 +1738,16 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
+	
+	/* re enable the sensitiveness on the db */
+	if (case_sensitive == FALSE)
+		symbol_db_engine_set_db_case_sensitive (dbe, TRUE);
+	
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -1851,10 +1782,7 @@
 	g_return_val_if_fail (dbe != NULL, -1);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 
 	if (db_file == NULL)
 	{
@@ -1862,8 +1790,7 @@
 						PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_NO_FILE))
 			== NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return -1;
 		}
 
@@ -1876,8 +1803,7 @@
 						PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID))
 			== NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return -1;
 		}
 
@@ -1888,8 +1814,7 @@
 		if ((param = gda_set_get_holder ((GdaSet*)plist, "dbfile")) == NULL)
 		{			
 			g_warning ("param dbfile is NULL from pquery!");
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return -1;
 		}
 		
@@ -1900,8 +1825,7 @@
 	if ((param = gda_set_get_holder ((GdaSet*)plist, "symid")) == NULL)
 	{			
 		g_warning ("param symid is NULL from pquery!");
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return -1;
 	}	
 	
@@ -1917,8 +1841,7 @@
 	{
 		if (data != NULL)
 			g_object_unref (data);
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return -1;
 	}
 
@@ -2002,8 +1925,7 @@
 		if ((stmt2 = sdb_engine_get_statement_by_query_id (dbe, 
 					PREP_QUERY_GET_PARENT_SCOPE_ID_BY_SYMBOL_ID_BY_SYMBOL_ID)) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return -1;
 		}
 
@@ -2014,8 +1936,7 @@
 		if ((param = gda_set_get_holder ((GdaSet*)plist, "scopedsymid")) == NULL)
 		{			
 			g_warning ("param scopedsymid is NULL from pquery!");
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return -1;
 		}	
 		
@@ -2033,8 +1954,7 @@
 		{
 			if (detailed_data != NULL)
 				g_object_unref (detailed_data);
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);		
+			SDB_UNLOCK(priv);
 			res = -1;
 		}	
 		else		/* ok we have a good result here */
@@ -2090,8 +2010,7 @@
 	}
 	g_object_unref (data);
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return res;
 }
 
@@ -2159,10 +2078,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	sym_info = sym_info & ~SYMINFO_KIND;
 	
@@ -2402,8 +2318,7 @@
 
 	if (dyn_node == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -2411,8 +2326,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -2423,8 +2337,7 @@
 	{	
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);			
 			return NULL;
 		}
 
@@ -2465,8 +2378,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "globalsearch")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 	
@@ -2474,8 +2386,7 @@
 	
 	if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "pattern")) == NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
@@ -2495,13 +2406,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -2534,10 +2443,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
 
-	if (priv->mutex)
-	{
-		g_mutex_lock (priv->mutex);
-	}
+	SDB_LOCK(priv);
 	
 	sym_info = sym_info & ~SYMINFO_FILE_PATH;
 	sym_info = sym_info & ~SYMINFO_PROJECT_NAME;
@@ -2601,8 +2507,7 @@
 	{
 		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "prj_name")) == NULL)
 		{
-			if (priv->mutex)
-				g_mutex_unlock (priv->mutex);
+			SDB_UNLOCK(priv);
 			return NULL;
 		}
 
@@ -2625,13 +2530,11 @@
 		if (data != NULL)
 			g_object_unref (data);
 		
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);		
+		SDB_UNLOCK(priv);
 		return NULL;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash,
 												priv->project_directory);	
@@ -2650,15 +2553,13 @@
 	g_return_val_if_fail (dbe != NULL, -1);
 	priv = dbe->priv;
 	
-	if (priv->mutex)
-		g_mutex_lock (priv->mutex);	
+	SDB_LOCK(priv);
 	
 	if ((stmt = sdb_engine_get_statement_by_query_id (dbe,
 								 PREP_QUERY_GET_LANGUAGE_COUNT))
 		== NULL)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return -1;
 	}
 
@@ -2671,8 +2572,7 @@
 	{
 		if (data_model != NULL)
 			g_object_unref (data_model);
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 		return -1;
 	}	
 	
@@ -2684,8 +2584,7 @@
 	if (data_model)
 		g_object_unref (data_model);
 	
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 	
 	return ret;	
 }
@@ -2701,8 +2600,7 @@
 	g_return_val_if_fail (language != NULL, FALSE);
 	
 	priv = dbe->priv;
-	if (priv->mutex)
-		g_mutex_lock (priv->mutex);
+	SDB_LOCK(priv);
 
 	MP_LEND_OBJ_STR(priv, value);
 	g_value_set_static_string (value, language);
@@ -2713,14 +2611,12 @@
 						"langname",
 						value)) < 0)
 	{
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
+		SDB_UNLOCK(priv);
 	
 		return FALSE;
 	}
 
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
+	SDB_UNLOCK(priv);
 
 	return TRUE;
 }

Modified: trunk/plugins/symbol-db/symbol-db-engine-queries.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-queries.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-queries.h	Fri Jan 16 21:11:51 2009
@@ -45,7 +45,9 @@
  */
 SymbolDBEngineIterator *
 symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe, 
-									const gchar *pattern, SymExtraInfo sym_info);
+									const gchar *pattern, 
+									gboolean case_sensitive,
+									SymExtraInfo sym_info);
 
 /**
  * @param pattern Pattern you want to search for. If NULL it will use '%' and LIKE for query.

Modified: trunk/plugins/symbol-db/symbol-db-view-search.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-search.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-search.c	Fri Jan 16 21:11:51 2009
@@ -106,7 +106,7 @@
 		pattern = g_strdup_printf ("%%%s%%", string);
 			
 		iterator = symbol_db_engine_find_symbol_by_name_pattern (priv->sdbe, 
-										pattern, SYMINFO_SIMPLE| SYMINFO_FILE_PATH |
+										pattern, FALSE, SYMINFO_SIMPLE| SYMINFO_FILE_PATH |
 												SYMINFO_ACCESS | SYMINFO_KIND);
 		g_free (pattern);
 		



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