[anjuta] symbol-db: Removed unused queries after symbol-model refactor
- From: Naba Kumar <naba src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: Removed unused queries after symbol-model refactor
- Date: Mon, 10 May 2010 21:10:40 +0000 (UTC)
commit 8865794dfe134ebf2a7fde8fe39c257f998716a1
Author: Naba Kumar <naba gnome org>
Date: Tue May 11 00:10:05 2010 +0300
symbol-db: Removed unused queries after symbol-model refactor
plugins/symbol-db/symbol-db-engine-core.c | 8 -
plugins/symbol-db/symbol-db-engine-priv.h | 2 -
plugins/symbol-db/symbol-db-engine-queries.c | 460 --------------------------
plugins/symbol-db/symbol-db-engine-queries.h | 30 --
4 files changed, 0 insertions(+), 500 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index 99f5d24..1d37a5b 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -2499,10 +2499,6 @@ sdb_engine_init (SymbolDBEngine * object)
FALSE);
DYN_QUERY_POPULATE_INIT_NODE(sdbe->priv->dyn_query_list,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED,
- TRUE);
-
- DYN_QUERY_POPULATE_INIT_NODE(sdbe->priv->dyn_query_list,
DYN_PREP_QUERY_GET_SCOPE_MEMBERS,
FALSE);
@@ -2511,10 +2507,6 @@ sdb_engine_init (SymbolDBEngine * object)
FALSE);
DYN_QUERY_POPULATE_INIT_NODE(sdbe->priv->dyn_query_list,
- DYN_PREP_QUERY_GET_FILE_SYMBOLS,
- TRUE);
-
- DYN_QUERY_POPULATE_INIT_NODE(sdbe->priv->dyn_query_list,
DYN_PREP_QUERY_GET_SYMBOL_INFO_BY_ID,
FALSE);
diff --git a/plugins/symbol-db/symbol-db-engine-priv.h b/plugins/symbol-db/symbol-db-engine-priv.h
index aeb8413..8c5cc95 100644
--- a/plugins/symbol-db/symbol-db-engine-priv.h
+++ b/plugins/symbol-db/symbol-db-engine-priv.h
@@ -198,10 +198,8 @@ typedef struct _static_query_node
typedef enum {
DYN_PREP_QUERY_GET_CLASS_PARENTS = 0,
DYN_PREP_QUERY_GET_CLASS_PARENTS_BY_SYMBOL_ID,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED,
DYN_PREP_QUERY_GET_SCOPE_MEMBERS,
DYN_PREP_QUERY_GET_CURRENT_SCOPE,
- DYN_PREP_QUERY_GET_FILE_SYMBOLS,
DYN_PREP_QUERY_GET_SYMBOL_INFO_BY_ID,
DYN_PREP_QUERY_FIND_SYMBOL_NAME_BY_PATTERN,
DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
diff --git a/plugins/symbol-db/symbol-db-engine-queries.c b/plugins/symbol-db/symbol-db-engine-queries.c
index 05cfe81..fa33910 100644
--- a/plugins/symbol-db/symbol-db-engine-queries.c
+++ b/plugins/symbol-db/symbol-db-engine-queries.c
@@ -545,289 +545,6 @@ symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name
* 3 bytes to map the main parameters.
* 1 byte is for filter_kinds number, so you'll be able to filter up to 255 parameters.
* |--------------------------------|-------------|
- * main parameters [3 bytes] extra [1 byte]
- */
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_LIMIT 0x0100
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_OFFSET 0x0200
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_YES 0x0400
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_NO 0x0800
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES 0x1000
-#define DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO 0x2000
-
-SymbolDBEngineIterator *
-symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe,
- SymType filter_kinds,
- gboolean include_kinds,
- gboolean group_them,
- gint results_limit,
- gint results_offset,
- SymExtraInfo sym_info)
-{
- SymbolDBEnginePriv *priv;
- GdaDataModel *data;
- GString *info_data;
- GString *join_data;
- GString *filter_str;
- gchar *query_str;
- const gchar *group_by_option;
- gchar *limit = "";
- gboolean limit_free = FALSE;
- gchar *offset = "";
- gboolean offset_free = FALSE;
- const DynChildQueryNode *dyn_node = NULL;
- GdaHolder *param;
- GValue *ret_value;
- gboolean ret_bool;
- GPtrArray *filter_kinds_array;
-
- /* use to merge multiple extra_parameters flags */
- gint other_parameters = 0;
-
- g_return_val_if_fail (dbe != NULL, NULL);
- priv = dbe->priv;
-
- 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.
- */
- sym_info = sym_info & ~SYMINFO_KIND;
-
- /* determine the filter_kinds thing */
- if (filter_kinds == SYMTYPE_UNDEF)
- filter_kinds_array = NULL;
- else
- filter_kinds_array = symbol_db_util_fill_type_array (filter_kinds);
-
- if (group_them == TRUE)
- {
- other_parameters |= DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_YES;
- group_by_option = "GROUP BY symbol.name";
- }
- else
- {
- other_parameters |= DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_GROUP_NO;
- group_by_option = "";
- }
-
- if (results_limit > 0)
- {
- other_parameters |= DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_LIMIT;
- limit_free = TRUE;
- limit = g_strdup_printf ("LIMIT ## /* name:'limit' type:gint */");
- }
-
- if (results_offset > 0)
- {
- other_parameters |= DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_OFFSET;
- offset = g_strdup_printf ("OFFSET ## /* name:'offset' type:gint */");
- offset_free = TRUE;
- }
-
- /* test if user gave an array with more than 255 filter_kinds. In that case
- * we'll not be able to save/handle it, so consider it as a NULL array
- */
- if (filter_kinds_array == NULL || filter_kinds_array->len > 255 || filter_kinds_array->len <= 0)
- {
- if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED, sym_info,
- other_parameters)) == NULL)
- {
- /* info_data contains the stuff after SELECT and befor FROM */
- info_data = g_string_new ("");
-
- /* join_data contains the optionals joins to do to retrieve new data on other
- * tables.
- */
- join_data = g_string_new ("");
-
- /* fill info_data and join data with optional sql */
- sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
-
- query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, "
- "symbol.name AS name, symbol.file_position AS file_position, "
- "symbol.is_file_scope AS is_file_scope, "
- "symbol.signature AS signature, symbol.returntype AS returntype"
- " %s, sym_kind.kind_name AS kind_name FROM symbol "
- "JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id %s "
- "WHERE symbol.scope_id <= 0 AND symbol.is_file_scope = 0 "
- "%s order by name %s %s", info_data->str, join_data->str,
- group_by_option, limit, offset);
-
- dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED,
- sym_info, other_parameters,
- query_str);
-
- g_free (query_str);
- g_string_free (join_data, TRUE);
- g_string_free (info_data, TRUE);
- }
- }
- else
- {
- if (include_kinds == TRUE)
- {
- other_parameters |=
- DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES;
- }
- else
- {
- other_parameters |=
- DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO;
- }
-
- /* set the number of parameters in the less important byte */
- other_parameters |= filter_kinds_array->len;
-
- if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED, sym_info,
- other_parameters)) == NULL)
- {
- gint i;
- /* info_data contains the stuff after SELECT and befor FROM */
- info_data = g_string_new ("");
-
- /* join_data contains the optionals joins to do to retrieve new data on other
- * tables.
- */
- join_data = g_string_new ("");
-
- /* fill info_data and join data with optional sql */
- sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
-
- /* prepare the dynamic filter string before the final query */
- filter_str = g_string_new ("");
-
- if (include_kinds == TRUE)
- {
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name IN (## /* name:'filter0' type:gchararray */");
- }
- else
- {
- filter_str = g_string_append (filter_str ,
- "AND sym_kind.kind_name NOT IN (## /* name:'filter0' type:gchararray */");
- }
-
- for (i = 1; i < filter_kinds_array->len; i++)
- {
- g_string_append_printf (filter_str ,
- ",## /* name:'filter%d' type:gchararray */", i);
- }
- filter_str = g_string_append (filter_str , ")");
-
- query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, "
- "symbol.name AS name, symbol.file_position AS file_position, "
- "symbol.is_file_scope AS is_file_scope, symbol.signature AS signature, "
- "symbol.returntype AS returntype "
- "%s, sym_kind.kind_name AS kind_name FROM symbol "
- "%s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
- "WHERE symbol.scope_id <= 0 AND symbol.is_file_scope = 0 "
- "%s %s order by name %s %s", info_data->str, join_data->str,
- filter_str->str, group_by_option, limit, offset);
-
- dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_GLOBAL_MEMBERS_FILTERED,
- sym_info, other_parameters,
- query_str);
-
- g_free (query_str);
- g_string_free (join_data, TRUE);
- g_string_free (info_data, TRUE);
- g_string_free (filter_str, TRUE);
- }
- }
-
- if (limit_free)
- g_free (limit);
-
- if (offset_free)
- g_free (offset);
-
- if (dyn_node == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- if (other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_LIMIT)
- {
- if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- MP_SET_HOLDER_BATCH_INT(priv, param, results_limit, ret_bool, ret_value);
- }
-
- if (other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_OFFSET)
- {
- if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- MP_SET_HOLDER_BATCH_INT(priv, param, results_offset, ret_bool, ret_value);
- }
-
-
- if (other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES ||
- other_parameters & DYN_GET_GLOBAL_MEMBERS_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO)
- {
- gint i;
- for (i = 0; i < filter_kinds_array->len; i++)
- {
- gchar *curr_str = g_strdup_printf ("filter%d", i);
- param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
-
- MP_SET_HOLDER_BATCH_STR(priv, param, g_ptr_array_index (filter_kinds_array, i),
- ret_bool, ret_value);
- g_free (curr_str);
- }
- }
-
- /*DEBUG_PRINT ("symbol_db_engine_get_global_members_filtered () query_str is %s",
- dyn_node->query_str);*/
-
-
- /* execute the query with parametes just set */
- data = gda_connection_statement_execute_select (priv->db_connection,
- (GdaStatement*)dyn_node->stmt,
- (GdaSet*)dyn_node->plist, NULL);
- MP_RESET_PLIST(dyn_node->plist);
-
- /* free the filter kinds, if it's not null */
- if (filter_kinds_array)
- {
- g_ptr_array_foreach (filter_kinds_array, (GFunc)g_free, NULL);
- g_ptr_array_free (filter_kinds_array, TRUE);
- }
-
- if (!GDA_IS_DATA_MODEL (data) ||
- gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
- {
- if (data != NULL)
- g_object_unref (data);
-
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- SDB_UNLOCK(priv);
- return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data,
- priv->sym_type_conversion_hash,
- priv->project_directory);
-}
-
-/**
- * Personalized GTree mapping:
- * Considering that a gint on a x86 is 4 bytes: we'll reserve:
- * 3 bytes to map the main parameters.
- * 1 byte is for filter_kinds number, so you'll be able to filter up to 255 parameters.
- * |--------------------------------|-------------|
* main parameters [3 bytes] extra [1 byte]
*/
#define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_LIMIT 0x0100
@@ -1520,183 +1237,6 @@ symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, const gchar* full_local
priv->project_directory);
}
-#define DYN_GET_FILE_SYMBOLS_EXTRA_PAR_LIMIT 1
-#define DYN_GET_FILE_SYMBOLS_EXTRA_PAR_OFFSET 2
-
-SymbolDBEngineIterator *
-symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe,
- const gchar *file_path,
- gint results_limit, gint results_offset,
- SymExtraInfo sym_info)
-{
- SymbolDBEnginePriv *priv;
- gchar *query_str;
- GdaDataModel *data;
- GString *info_data;
- GString *join_data;
- GdaHolder *param;
- const DynChildQueryNode *dyn_node;
- GValue *ret_value;
- gboolean ret_bool;
- gchar *limit = "";
- gboolean limit_free = FALSE;
- gchar *offset = "";
- gboolean offset_free = FALSE;
- gsize other_parameters;
- GError *error = NULL;
-
- g_return_val_if_fail (dbe != NULL, NULL);
- g_return_val_if_fail (file_path != NULL, NULL);
- priv = dbe->priv;
- g_return_val_if_fail (priv->db_directory != NULL, NULL);
-
- 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.
- */
- sym_info = sym_info & ~SYMINFO_FILE_PATH;
- sym_info = sym_info | SYMINFO_KIND; /* We need kind for a join */
-
- other_parameters = 0;
-
- if (results_limit > 0)
- {
- limit = g_strdup_printf ("LIMIT ## /* name:'limit' type:gint */");
- limit_free = TRUE;
- other_parameters |= DYN_GET_FILE_SYMBOLS_EXTRA_PAR_LIMIT;
- }
-
- if (results_offset > 0)
- {
- offset = g_strdup_printf ("OFFSET ## /* name:'offset' type:gint */");
- offset_free = TRUE;
- other_parameters |= DYN_GET_FILE_SYMBOLS_EXTRA_PAR_OFFSET;
- }
-
- gchar *relative_path = symbol_db_util_get_file_db_path (dbe, file_path);
- if (relative_path == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_FILE_SYMBOLS, sym_info, other_parameters)) == NULL)
- {
- /* info_data contains the stuff after SELECT and befor FROM */
- info_data = g_string_new ("");
-
- /* join_data contains the optionals joins to do to retrieve new data on other
- * tables.
- */
- join_data = g_string_new ("");
-
- /* fill info_data and join data with optional sql */
- sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
-
- /* rember to do a file_path + strlen(priv->db_directory): a project relative
- * file path
- */
- query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, "
- "symbol.name AS name, symbol.file_position AS file_position, "
- "symbol.is_file_scope AS is_file_scope, symbol.signature AS signature, "
- "symbol.returntype AS returntype, file.file_path AS db_file_path "
- "%s FROM symbol "
- "JOIN file ON symbol.file_defined_id = file.file_id "
- /* "JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id " */
- "%s WHERE (symbol.scope_id = 0 AND file.file_path = ## /* name:'filepath' type:gchararray */) "
- "or (symbol.scope_id = 0 AND sym_kind.kind_name != 'namespace' AND symbol.scope_definition_id in (select scope_id from symbol join file on "
- "symbol.file_defined_id = file.file_id where "
- "file.file_path = ## /* name:'filepath' type:gchararray */ "
- "group by symbol.scope_id)) "
- "GROUP BY symbol.scope_definition_id ORDER BY symbol.file_position %s %s",
- info_data->str, join_data->str, limit, offset);
-
- dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
- DYN_PREP_QUERY_GET_FILE_SYMBOLS,
- sym_info, other_parameters,
- query_str);
- g_free (query_str);
- g_string_free (info_data, TRUE);
- g_string_free (join_data, TRUE);
- }
-
- if (limit_free)
- g_free (limit);
-
- if (offset_free)
- g_free (offset);
-
- if (dyn_node == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- /*DEBUG_PRINT ("query for symbol_db_engine_get_file_symbols is %s [filepath: %s]",
- dyn_node->query_str, file_path);*/
-
- if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "filepath")) == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- MP_SET_HOLDER_BATCH_STR(priv, param, relative_path, ret_bool, ret_value);
-
- if (results_limit > 0)
- {
- if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- MP_SET_HOLDER_BATCH_INT(priv, param, results_limit, ret_bool, ret_value);
- }
-
- if (results_offset > 0)
- {
- if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
- {
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- MP_SET_HOLDER_BATCH_INT(priv, param, results_offset, ret_bool, ret_value);
- }
-
- /* execute the query with parametes just set */
- data = gda_connection_statement_execute_select (priv->db_connection,
- (GdaStatement*)dyn_node->stmt,
- (GdaSet*)dyn_node->plist, &error);
- if (error)
- {
- g_warning ("SQL error: %s: %s", dyn_node->query_str, error->message);
- g_error_free (error);
- }
-
- MP_RESET_PLIST(dyn_node->plist);
-
- if (!GDA_IS_DATA_MODEL (data) ||
- gda_data_model_get_n_rows (data) <= 0)
- {
- if (data != NULL)
- g_object_unref (data);
-
- SDB_UNLOCK(priv);
- return NULL;
- }
-
- g_free (relative_path);
-
- SDB_UNLOCK(priv);
- return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data,
- priv->sym_type_conversion_hash,
- priv->project_directory);
-}
-
#define DYN_FIND_SYMBOL_NAME_BY_PATTERN_EXTRA_PAR_EXACT_MATCH_YES 0x010000
#define DYN_FIND_SYMBOL_NAME_BY_PATTERN_EXTRA_PAR_EXACT_MATCH_NO 0x020000
diff --git a/plugins/symbol-db/symbol-db-engine-queries.h b/plugins/symbol-db/symbol-db-engine-queries.h
index 3957bab..658ce1f 100644
--- a/plugins/symbol-db/symbol-db-engine-queries.h
+++ b/plugins/symbol-db/symbol-db-engine-queries.h
@@ -165,36 +165,6 @@ symbol_db_engine_get_current_scope (SymbolDBEngine *dbe,
gulong line,
SymExtraInfo sym_info);
-
-/**
- * Use this function to get symbols of a file.
- */
-SymbolDBEngineIterator *
-symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe,
- const gchar *file_path, gint limit,
- gint offset, SymExtraInfo sym_info);
-
-/**
- * Use this function to get global symbols only. I.e. private or file-only scoped symbols
- * will NOT be returned.
- * @param filter_kinds Can be set to SYMTYPE_UNDEF. In that case these filters will not be taken into consideration.
- * at root level [global level]. A maximum of 255 filter_kinds are admitted.
- * @param include_kinds Should we include in the result the filter_kinds or not?
- * @param group_them If TRUE then will be issued a 'group by symbol.name' option.
- * If FALSE you can have as result more symbols with the same name but different
- * symbols id. See for example more namespaces declared on different files.
- * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
- * @param results_offset Skip results_offset results. -1 If you don't want to use this par.
- */
-SymbolDBEngineIterator *
-symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe,
- SymType filter_kinds,
- gboolean include_kinds,
- gboolean group_them,
- gint results_limit,
- gint results_offset,
- SymExtraInfo sym_info);
-
/**
* No iterator for now. We need the quickest query possible.
* @param scoped_symbol_id Symbol you want to know the parent of.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]