[anjuta/sdb-core-trans: 13/14] symbol-db: more sym_type removals. Models are now free of it.



commit 024a497d46e106bac7927034a0fce79f934decd8
Author: Massimo Corà <mcora src gnome org>
Date:   Sun Jun 20 15:38:12 2010 +0200

    symbol-db: more sym_type removals. Models are now free of it.

 libanjuta/interfaces/libanjuta.idl          |    4 +-
 plugins/symbol-db/symbol-db-engine-core.c   |  393 +-------------------------
 plugins/symbol-db/symbol-db-model-file.c    |    5 +-
 plugins/symbol-db/symbol-db-model-project.c |    5 +-
 plugins/symbol-db/symbol-db-model-search.c  |    5 +-
 plugins/symbol-db/symbol-db-query.c         |    6 +-
 plugins/symbol-db/tables.sql                |   18 +-
 7 files changed, 31 insertions(+), 405 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index 8054d45..0364867 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -5291,12 +5291,12 @@ interface IAnjutaSymbol
 		FIELD_FILE_SCOPE,
 		FIELD_SIGNATURE,
 		FIELD_RETURNTYPE,
+		FIELD_TYPE,
+		FIELD_TYPE_NAME,		
 		FIELD_FILE_PATH,
 		FIELD_IMPLEMENTATION,
 		FIELD_ACCESS,
 		FIELD_KIND,
-		FIELD_TYPE,
-		FIELD_TYPE_NAME,
 		FIELD_IS_CONTAINER,
 		FIELD_END
 	}
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index acb941e..afc0966 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -25,83 +25,6 @@
  * 	Boston, MA  02110-1301, USA.
  */
 
-/*
-Interesting queries:
-
-------------------------
-* get all namespaces.
-select symbol.name from symbol join sym_kind on symbol.kind_id = 
-	sym_kind.sym_kind_id where sym_kind.kind_name = "namespace";
-
-------------------------
-* get all symbols_id which scope is under all namespaces' ones
-select * from symbol where scope_id in (select symbol.scope_definition_id 
-	from symbol join sym_kind on symbol.kind_id = sym_kind.sym_kind_id where 
-	sym_kind.kind_name = "namespace");
-
-------------------------
-* get all symbols which have a scope_id of symbol X. X is a symbol of kind namespace,
-class, struct etc. Symbol X can be retrieved by something like
-select * from symbol join sym_type on symbol.type_id = sym_type.type_id where 
-symbol.name = "First" and sym_type.type_type = "namespace";
-our query is:
-select * from symbol where scope_id = ;
-at the end we have:
-
-select * from symbol where scope_id = (select scope_definition_id from symbol join 
-	sym_type on symbol.type_id = sym_type.type_id where symbol.name = 
-	"First" and sym_type.type_type = "namespace");
-
-------------------------
-* get a symbol by its name and type. In this case we want to search for the
-  class Fourth_2_class
-select * from symbol join sym_type on symbol.type_id = sym_type.type_id where 
-	symbol.name = "Fourth_2_class" and sym_type.type = "class";
-
-sqlite> select * from symbol join sym_kind on symbol.kind_id = sym_kind.sym_kind_id  
-			join scope on scope.scope_id = symbol.scope_id 
-			join sym_type on sym_type.type_id = scope.type_id 
-		where symbol.name = "Fourth_2_class" 
-			and sym_kind.kind_name = "class" 
-			and scope = "Fourth" 
-			and sym_type.type = "namespace";
-
-183|13|Fourth_2_class|52|0||140|137|175|8|-1|-1|0|8|class|137|Fourth|172|172|namespace|Fourth
-
-* OR * 
-------------------------		
-* get the *derived symbol*
-select * from symbol 
-	join sym_kind on symbol.kind_id = sym_kind.sym_kind_id 
-	where symbol.name = "Fourth_2_class" 
-		and sym_kind.kind_name = "class" 
-		and symbol.scope_id in (select scope.scope_id from scope 
-									join sym_type on scope.type_id = sym_type.type_id 
-									where sym_type.type = 'namespace' 
-										and sym_type.type_name = 'Fourth');
-
-------------------------
-* query that get the symbol's parent classes
-
-select symbol_id_base, symbol.name from heritage 
-	join symbol on heritage.symbol_id_base = symbol.symbol_id 
-	where symbol_id_derived = (
-		select symbol_id from symbol 
-			join sym_kind on symbol.kind_id = sym_kind.sym_kind_id 
-			where symbol.name = "Fourth_2_class" 
-				and sym_kind.kind_name = "class" 
-				and symbol.scope_id in (
-					select scope.scope_id from scope 
-						join sym_type on scope.type_id = sym_type.type_id 
-						where sym_type.type = 'namespace' 
-							and sym_type.type_name = 'Fourth'
-					)
-		);
-
-182|Fourth_1_class
-
-*/
-
 #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -124,35 +47,8 @@ select symbol_id_base, symbol.name from heritage
 #include "symbol-db-engine-core.h"
 #include "symbol-db-engine-utils.h"
 
-
 #include <glib/gprintf.h>
 
-#define WRITE_SQL_LOG(format, ...) ;
-/*
-#define WRITE_SQL_LOG(format, ...) { \
-		FILE *file; \
-		file = fopen("/tmp/sql.log", "a"); \
-		g_fprintf (file, format";\n", ##__VA_ARGS__); \
-		fclose (file); \
-}
-*/
-
-#define DEBUG_WRITE_SQL_LOG(format) { \
-		FILE *file; \
-		file = fopen("/tmp/debug_sql.log", "a"); \
-		g_fprintf (file, format); \
-		fclose (file); \
-}
-
-#define DEBUG_DUMP_HASH_VALUES(value) ;
-/*
-#define DEBUG_DUMP_HASH_VALUES(value) { \
-		FILE *file; \
-		file = fopen("/tmp/hash_values.log", "a"); \
-		g_fprintf (file, "%s\n", value); \
-		fclose (file); \
-}
-*/
 
 typedef struct _TableMapTmpHeritage {
 	gint symbol_referer_id;
@@ -2726,8 +2622,10 @@ sdb_engine_init (SymbolDBEngine * object)
 	
 	for (i = 0; i < MEMORY_POOL_STRING_SIZE; i++) 
 	{
-		GValue *value = gda_value_new (G_TYPE_STRING);
+		GValue *value = g_slice_new0 (GValue);
+  		g_value_init (value, G_TYPE_STRING);		
 		g_value_set_static_string (value, MP_VOID_STRING);
+		
 #ifdef USE_ASYNC_QUEUE	
 		g_async_queue_push (sdbe->priv->mem_pool_string, value);
 #else
@@ -2737,7 +2635,9 @@ sdb_engine_init (SymbolDBEngine * object)
 
 	for (i = 0; i < MEMORY_POOL_INT_SIZE; i++) 
 	{
-		GValue *value = gda_value_new (G_TYPE_INT);
+		GValue *value = g_slice_new0 (GValue);
+  		g_value_init (value, G_TYPE_INT);
+		
 #ifdef USE_ASYNC_QUEUE			
 		g_async_queue_push (sdbe->priv->mem_pool_int, value);		
 #else
@@ -2758,6 +2658,12 @@ sdb_engine_unref_removed_launchers (gpointer data, gpointer user_data)
 	g_object_unref (data);
 }
 
+static void 
+sdb_engine_gvalue_free (gpointer data, gpointer user_data)
+{
+	g_slice_free (GValue, data);
+}
+
 static void
 sdb_engine_finalize (GObject * object)
 {
@@ -2878,10 +2784,10 @@ sdb_engine_finalize (GObject * object)
 	priv->mem_pool_string = NULL;
 	priv->mem_pool_int = NULL;	
 #else
-	g_queue_foreach (priv->mem_pool_string, (GFunc)gda_value_free, NULL);
+	g_queue_foreach (priv->mem_pool_string, (GFunc)sdb_engine_gvalue_free, NULL);
 	g_queue_free (priv->mem_pool_string);
 	
-	g_queue_foreach (priv->mem_pool_int, (GFunc)gda_value_free, NULL);
+	g_queue_foreach (priv->mem_pool_int, (GFunc)sdb_engine_gvalue_free, NULL);
 	g_queue_free (priv->mem_pool_int);	
 	
 	priv->mem_pool_string = NULL;
@@ -3543,10 +3449,6 @@ CREATE TABLE workspace (workspace_id integer PRIMARY KEY AUTOINCREMENT,
 	}
 	MP_SET_HOLDER_BATCH_STR(priv, param, workspace_name, ret_bool, ret_value);
 
-
-	WRITE_SQL_LOG ("INSERT INTO workspace (workspace_name, analyse_time) "
-	 			"VALUES ('%s', datetime ('now', 'localtime'))	", workspace_name);
-	
 	/* execute the query with parametes just set */
 	if (gda_connection_statement_execute_non_select (priv->db_connection, 
 														  (GdaStatement*)stmt, 
@@ -3698,10 +3600,6 @@ CREATE TABLE project (project_id integer PRIMARY KEY AUTOINCREMENT,
 	
 	MP_SET_HOLDER_BATCH_INT(priv, param, wks_id, ret_bool, ret_value);	
 
-	WRITE_SQL_LOG ("INSERT INTO project (project_name, wrkspace_id, analyse_time) "
-	 	"VALUES ('%s',"
-	 	"%d, datetime ('now', 'localtime'))", project, wks_id);
-		 
 	/* execute the query with parametes just set */
 	if (gda_connection_statement_execute_non_select (priv->db_connection, 
 														  (GdaStatement*)stmt, 
@@ -3915,11 +3813,6 @@ CREATE TABLE file (file_id integer PRIMARY KEY AUTOINCREMENT,
 
 		MP_SET_HOLDER_BATCH_INT(priv, param, language_id, ret_bool, ret_value);
 
-
-		WRITE_SQL_LOG ("INSERT INTO file (file_path, prj_id, lang_id, analyse_time) VALUES ("
-	 	"'%s', %d, %d, "
-	 	"datetime ('now', 'localtime'))", local_filepath, project_id, language_id);
-		
 		/* execute the query with parametes just set */
 		if (gda_connection_statement_execute_non_select (priv->db_connection, 
 														 (GdaStatement*)stmt, 
@@ -4201,237 +4094,6 @@ sdb_engine_extract_type_qualifier (const gchar *string, const gchar *expr)
 	return res;
 }
 
-
-#if 0
-static void
-sdb_engine_tablemap_db_flush_sym_type (SymbolDBEngine * dbe)
-{
-	SymbolDBEnginePriv *priv;
-	gint i;
-	gint queue_length;
-	const GdaSet *plist;
-	const GdaStatement *stmt;
-	GdaHolder *param_type;
-	GdaHolder *param_typename;
-	GValue *ret_value;
-	gboolean ret_bool;
-	GError *error = NULL;
-	
-
-	priv = dbe->priv;
-	
-	DEBUG_PRINT ("Preparing SYM_TYPE flush on db");
-#ifdef DEBUG
-	GTimer *sym_timer_DEBUG  = g_timer_new ();	
-#endif	
-
-	queue_length = g_queue_get_length (priv->sym_type_tablemap_queue);
-
-	gda_connection_begin_transaction (priv->db_connection, "symtypetrans", 
-	    GDA_TRANSACTION_ISOLATION_READ_UNCOMMITTED, &error);
-
-	if (error)
-	{
-		g_warning (error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	if ((stmt = sdb_engine_get_statement_by_query_id (dbe, PREP_QUERY_SYM_TYPE_NEW))
-		== NULL)
-	{
-		g_warning ("query is null");
-		return;
-	}
-
-	plist = sdb_engine_get_query_parameters_list (dbe, PREP_QUERY_SYM_TYPE_NEW);	
-
-	/* type parameter */
-	if ((param_type = gda_set_get_holder ((GdaSet*)plist, "type")) == NULL)
-	{
-		g_warning ("param type is NULL from pquery!");
-		return;
-	}
-	
-	/* type_name parameter */
-	if ((param_typename = gda_set_get_holder ((GdaSet*)plist, "typename")) == NULL)
-	{
-		g_warning ("param typename is NULL from pquery!");
-		return;
-	}
-	
-	for (i = 0; i < queue_length; i++)
-	{
-		gchar * value = g_queue_pop_head (priv->sym_type_tablemap_queue);
-		gchar **tokens = g_strsplit (value, "|", 2);		
-
-		MP_SET_HOLDER_BATCH_STR(priv, param_type, tokens[0], ret_bool, ret_value);		
-		MP_SET_HOLDER_BATCH_STR(priv, param_typename, tokens[1], ret_bool, ret_value);
-
-		/* execute the query with parametes just set */
-		gda_connection_statement_execute_non_select (priv->db_connection, 
-														 (GdaStatement*)stmt, 
-														 (GdaSet*)plist, NULL,
-														 NULL);
-
-		g_strfreev(tokens);
-		/* no need to free value, it'll be freed when associated value 
-		 * on hashtable'll be freed
-		 */
-		MP_RESET_PLIST(plist);
-	}
-
-	gda_connection_commit_transaction (priv->db_connection, "symtypetrans", &error);
-
-	if (error)
-	{
-		g_warning (error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-	
-#ifdef DEBUG	
-	gdouble elapsed_DEBUG = g_timer_elapsed (sym_timer_DEBUG, NULL);	
-	DEBUG_PRINT ("===== elapsed using GDA TRANSACTION: %f", elapsed_DEBUG);
-	g_timer_destroy (sym_timer_DEBUG);
-#endif
-
-	/* free also all the keys/values on hashtable */
-	g_hash_table_remove_all (priv->sym_type_tablemap_hash);	
-}
-#endif
-
-#if 0
-/* ### Thread note: this function inherits the mutex lock ### */
-static GNUC_INLINE gint
-sdb_engine_add_new_sym_type (SymbolDBEngine * dbe, const tagEntry * tag_entry)
-{
-/*
-	CREATE TABLE sym_type (type_id integer PRIMARY KEY AUTOINCREMENT,
-                   type_type varchar (256) not null ,
-                   type_name varchar (256) not null
-                   unique (type_type, type_name)
-                   );
-*/
-	const gchar *type;
-	const gchar *type_name;
-	gint table_id;	
-	const GdaSet *plist;
-	const GdaStatement *stmt;
-	GdaHolder *param;
-	GdaSet *last_inserted = NULL;
-	SymbolDBEnginePriv *priv;
-	GValue *ret_value;
-	gboolean ret_bool;
-	gchar *type_regex;;
-	
-	priv = dbe->priv;
-
-	/* we assume that tag_entry is != NULL */
-	type = tag_entry->kind;
-	type_regex = NULL;
-	
-	if (g_strcmp0 (type, "member") == 0 || 
-	    g_strcmp0 (type, "variable") == 0 || 
-	    g_strcmp0 (type, "field") == 0)
-	{
-		type_regex = sdb_engine_extract_type_qualifier (tag_entry->address.pattern, 
-		                                                tag_entry->name);
-		/*DEBUG_PRINT ("type_regex for %s [kind %s] is %s", tag_entry->name, 
-		             tag_entry->kind, type_regex);*/
-		type_name = type_regex;
-
-		/* if the extractor failed we should fallback to the default one */
-		if (type_name == NULL)
-			type_name = tag_entry->name;
-	}
-	else 
-	{
-		type_name = tag_entry->name;
-	}
-
-	/* is this the first population? if yes skip to the proper function */
-	if (priv->is_first_population == TRUE)
-	{
-		table_id = sdb_engine_add_new_sym_type_1st (dbe, tag_entry, type, type_name);
-		g_free (type_regex);
-		return table_id;
-	}
-	
-	
-	/* it does not exist. Create a new tuple. */
-	if ((stmt = sdb_engine_get_statement_by_query_id (dbe, PREP_QUERY_SYM_TYPE_NEW))
-		== NULL)
-	{
-		g_warning ("query is null");
-		return -1;
-	}
-
-	plist = sdb_engine_get_query_parameters_list (dbe, PREP_QUERY_SYM_TYPE_NEW);
-
-	/* type parameter */
-	if ((param = gda_set_get_holder ((GdaSet*)plist, "type")) == NULL)
-	{
-		g_warning ("param type is NULL from pquery!");
-		return -1;
-	}
-
-	MP_SET_HOLDER_BATCH_STR(priv, param, type, ret_bool, ret_value);
-
-	/* type_name parameter */
-	if ((param = gda_set_get_holder ((GdaSet*)plist, "typename")) == NULL)
-	{
-		g_warning ("param typename is NULL from pquery!");
-		return -1;
-	}
-	
-	MP_SET_HOLDER_BATCH_STR(priv, param, type_name, ret_bool, ret_value);
-
-	/* execute the query with parametes just set */
-	if (gda_connection_statement_execute_non_select (priv->db_connection, 
-													 (GdaStatement*)stmt, 
-													 (GdaSet*)plist, &last_inserted,
-													 NULL) == -1)
-	{
-		GValue *value1, *value2;
-		
-		MP_LEND_OBJ_STR (priv, value1);
-		g_value_set_static_string (value1, type);
-
-		MP_LEND_OBJ_STR (priv, value2);
-		g_value_set_static_string (value2, type_name);		
-
-		if ((table_id = sdb_engine_get_tuple_id_by_unique_name2 (dbe,
-													 PREP_QUERY_GET_SYM_TYPE_ID,
-													 "type", value1,
-													 "typename", value2)) < 0)
-		{
-			table_id = -1;
-		}
-
-		MP_RESET_PLIST(plist);
-		g_free (type_regex);
-		return table_id;
-	}	
-	else 
-	{
-
-		WRITE_SQL_LOG ("INSERT INTO sym_type (type_type, type_name) VALUES ('%s', '%s')", 
-	    				type, type_name );
-		
-		const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
-		table_id = g_value_get_int (value);
-	}		
-	
-	if (last_inserted)
-		g_object_unref (last_inserted);	
-
-	MP_RESET_PLIST(plist);
-	g_free (type_regex);
-	return table_id;
-}
-#endif
-
 /* ### Thread note: this function inherits the mutex lock ### */
 static gint
 sdb_engine_add_new_sym_kind (SymbolDBEngine * dbe, const tagEntry * tag_entry)
@@ -4513,9 +4175,6 @@ sdb_engine_add_new_sym_kind (SymbolDBEngine * dbe, const tagEntry * tag_entry)
 		
 		MP_SET_HOLDER_BATCH_INT(priv, param, is_container, ret_bool, ret_value);
 
-		WRITE_SQL_LOG ("INSERT INTO sym_kind (kind_name, is_container) VALUES('%s',"
-		    "%d)", kind_name, is_container);
-		
 		/* execute the query with parametes just set */
 		if (gda_connection_statement_execute_non_select(priv->db_connection, 
 														 (GdaStatement*)stmt, 
@@ -4777,9 +4436,6 @@ sdb_engine_add_new_heritage (SymbolDBEngine * dbe, gint base_symbol_id,
 	
 	MP_SET_HOLDER_BATCH_INT(priv, param, derived_symbol_id, ret_bool, ret_value);		
 
-	WRITE_SQL_LOG ("INSERT INTO heritage (symbol_id_base, symbol_id_derived) VALUES(%d, "
-	"%d)", base_symbol_id, derived_symbol_id);
-	
 	/* execute the query with parametes just set */
 	if (gda_connection_statement_execute_non_select (priv->db_connection, 
 													 (GdaStatement*)stmt, 
@@ -5031,11 +4687,8 @@ sdb_engine_add_new_scope_definition (SymbolDBEngine * dbe, const tagEntry * tag_
 			table_id = -1;
 		}
 	}
-	else  {
-
-		WRITE_SQL_LOG ("INSERT INTO scope (scope_name, type_id) VALUES('%s'"
-	 			", %d)",  scope, type_table_id);
-		
+	else  
+	{
 		const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
 		table_id = g_value_get_int (value);
 	}	
@@ -6087,20 +5740,6 @@ sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
 	
 	MP_SET_HOLDER_BATCH_INT(priv, param, update_flag, ret_bool, ret_value);
 
-	WRITE_SQL_LOG (	 	"INSERT INTO symbol (file_defined_id, name, file_position, "
-	 	"is_file_scope, signature, returntype, scope_definition_id, scope_id, type_id, "
-	 	"kind_id, access_kind_id, implementation_kind_id, update_flag) VALUES("
-	 	"%d , '%s' "
-	 	", %d, "
-	 	"%d , '%s' "
-	 	", '%s', "
-		"%d, %d, %d, %d, %d, "
-	 	"%d, %d)", file_defined_id, name, file_position, 
-	    is_file_scope, signature, returntype, scope_definition_id, scope_id, type_id, 
-	    kind_id, access_kind_id, implementation_kind_id, update_flag);
-	    
-	    
-	
 	/* execute the query with parametes just set */
 	gint nrows;
 	
diff --git a/plugins/symbol-db/symbol-db-model-file.c b/plugins/symbol-db/symbol-db-model-file.c
index 301271c..1b299f1 100644
--- a/plugins/symbol-db/symbol-db-model-file.c
+++ b/plugins/symbol-db/symbol-db-model-file.c
@@ -28,15 +28,14 @@
 		symbol.scope_definition_id, \
 		symbol.signature, \
 		symbol.returntype, \
+		symbol.type_type, \
+		symbol.type_name, \
 		file.file_path, \
 		sym_access.access_name, \
-		sym_type.type_type, \
-		sym_type.type_name, \
 		sym_kind.is_container \
 	FROM symbol \
 	LEFT JOIN file ON symbol.file_defined_id = file.file_id \
 	LEFT JOIN sym_access ON symbol.access_kind_id = sym_access.access_kind_id \
-	LEFT JOIN sym_type ON symbol.type_id = sym_type.type_id \
 	LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id \
 	WHERE \
 	( \
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index 174d41a..e14a266 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -28,15 +28,14 @@
 		symbol.scope_definition_id, \
 		symbol.signature, \
 		symbol.returntype, \
+		symbol.type_type, \
+		symbol.type_name, \
 		file.file_path, \
 		sym_access.access_name, \
-		sym_type.type_type, \
-		sym_type.type_name, \
 		sym_kind.is_container \
 	FROM symbol \
 	LEFT JOIN file ON symbol.file_defined_id = file.file_id \
 	LEFT JOIN sym_access ON symbol.access_kind_id = sym_access.access_kind_id \
-	LEFT JOIN sym_type ON symbol.type_id = sym_type.type_id \
 	LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id \
 	WHERE \
 	( \
diff --git a/plugins/symbol-db/symbol-db-model-search.c b/plugins/symbol-db/symbol-db-model-search.c
index 7b49a9b..090e2a8 100644
--- a/plugins/symbol-db/symbol-db-model-search.c
+++ b/plugins/symbol-db/symbol-db-model-search.c
@@ -29,15 +29,14 @@
 		symbol.scope_definition_id, \
 		symbol.signature, \
 		symbol.returntype, \
+		symbol.type_type, \
+		symbol.type_name, \
 		file.file_path, \
 		sym_access.access_name, \
-		sym_type.type_type, \
-		sym_type.type_name, \
 		sym_kind.is_container \
 	FROM symbol \
 	LEFT JOIN file ON symbol.file_defined_id = file.file_id \
 	LEFT JOIN sym_access ON symbol.access_kind_id = sym_access.access_kind_id \
-	LEFT JOIN sym_type ON symbol.type_id = sym_type.type_id \
 	LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id \
 	WHERE symbol.name LIKE ## /* name:'pattern' type:gchararray */ \
 	ORDER BY symbol.name \
diff --git a/plugins/symbol-db/symbol-db-query.c b/plugins/symbol-db/symbol-db-query.c
index a00ae0f..7a436b3 100644
--- a/plugins/symbol-db/symbol-db-query.c
+++ b/plugins/symbol-db/symbol-db-query.c
@@ -85,7 +85,6 @@ typedef enum
 	SDB_QUERY_TABLE_FILE,
 	SDB_QUERY_TABLE_IMPLEMENTATION,
 	SDB_QUERY_TABLE_ACCESS,
-	SDB_QUERY_TABLE_TYPE,
 	SDB_QUERY_TABLE_KIND,
 	SDB_QUERY_TABLE_MAX,
 }  SdbQueryTable;
@@ -97,7 +96,6 @@ static gchar *table_joins[] =
 	"LEFT JOIN file ON symbol.file_defined_id = file.file_id",
 	"LEFT JOIN sym_implementation ON symbol.implementation_kind_id = sym_implementation.sym_impl_id",
 	"LEFT JOIN sym_access ON symbol.access_kind_id = sym_access.access_kind_id",
-	"LEFT JOIN sym_type ON symbol.type_id = sym_type.type_id",
 	"LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id"
 };
 
@@ -119,12 +117,12 @@ SdbQueryFieldSpec field_specs[] = {
 	{"symbol.is_file_scope ", SDB_QUERY_TABLE_SYMBOL},
 	{"symbol.signature ", SDB_QUERY_TABLE_SYMBOL},
 	{"symbol.returntype ", SDB_QUERY_TABLE_SYMBOL},
+	{"symbol.type_type", SDB_QUERY_TABLE_SYMBOL},
+	{"symbol.type_name", SDB_QUERY_TABLE_SYMBOL},
 	{"file.file_path", SDB_QUERY_TABLE_FILE},
 	{"sym_implementation.implementation_name", SDB_QUERY_TABLE_IMPLEMENTATION},
 	{"sym_access.access_name", SDB_QUERY_TABLE_ACCESS},
 	{"sym_kind.kind_name ", SDB_QUERY_TABLE_KIND},
-	{"sym_type.type_type ", SDB_QUERY_TABLE_TYPE},
-	{"sym_type.type_name", SDB_QUERY_TABLE_TYPE},
 	{"sym_kind.is_container", SDB_QUERY_TABLE_KIND}
 };
 
diff --git a/plugins/symbol-db/tables.sql b/plugins/symbol-db/tables.sql
index 82e161f..1f3fa29 100644
--- a/plugins/symbol-db/tables.sql
+++ b/plugins/symbol-db/tables.sql
@@ -46,13 +46,6 @@ CREATE TABLE symbol (symbol_id integer PRIMARY KEY AUTOINCREMENT,
                      unique (name, file_defined_id, file_position)
                      );
 
---DROP TABLE IF EXISTS sym_type;
---CREATE TABLE sym_type (type_id integer PRIMARY KEY AUTOINCREMENT,
---                   type_type text not null,
---                   type_name text not null,
---                   unique (type_type, type_name)
---                   );
-
 DROP TABLE IF EXISTS sym_kind;
 CREATE TABLE sym_kind (sym_kind_id integer PRIMARY KEY AUTOINCREMENT,
                        kind_name text not null unique,
@@ -92,15 +85,14 @@ CREATE TABLE __tmp_removed (tmp_removed_id integer PRIMARY KEY AUTOINCREMENT,
                             );
 
 
---DROP INDEX IF EXISTS symbol_idx_1;
+DROP INDEX IF EXISTS symbol_idx_1;
 CREATE INDEX symbol_idx_1 ON symbol (name, file_defined_id, type_type, type_name);
 
---DROP INDEX IF EXISTS symbol_idx_2;
---CREATE INDEX symbol_idx_2 ON symbol (scope_id);
+DROP INDEX IF EXISTS symbol_idx_2;
+CREATE INDEX symbol_idx_2 ON symbol (scope_id);
 
--- FIXME
---DROP INDEX IF EXISTS symbol_idx_3;
---CREATE INDEX symbol_idx_3 ON symbol (type_id);
+DROP INDEX IF EXISTS symbol_idx_3;
+CREATE INDEX symbol_idx_3 ON symbol (type_type, type_name);
 
 DROP TRIGGER IF EXISTS delete_file_trg;
 CREATE TRIGGER delete_file_trg BEFORE DELETE ON file



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