[anjuta/cxxparser] symbol-db: added a query test and fixed a bug introduced with previous patch
- From: Massimo Cora' <mcora src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta/cxxparser] symbol-db: added a query test and fixed a bug introduced with previous patch
- Date: Fri, 31 Jul 2009 23:27:03 +0000 (UTC)
commit 796e8c9503e211eb4050afd4711a429ec942e065
Author: Massimo Corà <mcora src gnome org>
Date: Thu Jul 30 17:45:29 2009 +0200
symbol-db: added a query test and fixed a bug introduced with previous patch
libanjuta/interfaces/libanjuta.idl | 3 +-
plugins/symbol-db/symbol-db-engine-queries.c | 43 ++++++++++++++------------
plugins/symbol-db/test-queries/main.c | 40 ++++++++++++++++++++++--
3 files changed, 62 insertions(+), 24 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index 6f9e75a..bb9380e 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -4888,7 +4888,8 @@ interface IAnjutaSymbol
/**
* IAnjutaSymbolType:
*
- * @IANJUTA_SYMBOL_TYPE_UNDEF: Unknown type
+ * @IANJUTA_SYMBOL_TYPE_UNDEF: Unknown type. If you have to search for all the known
+ * types use this flag because it's quicker than #IANJUTA_SYMBOL_TYPE_MAX.
* @IANJUTA_SYMBOL_TYPE_CLASS: Class declaration
* @IANJUTA_SYMBOL_TYPE_ENUM: Enum declaration
* @IANJUTA_SYMBOL_TYPE_ENUMERATOR: Enumerator value
diff --git a/plugins/symbol-db/symbol-db-engine-queries.c b/plugins/symbol-db/symbol-db-engine-queries.c
index b7c79f2..9d77816 100644
--- a/plugins/symbol-db/symbol-db-engine-queries.c
+++ b/plugins/symbol-db/symbol-db-engine-queries.c
@@ -786,6 +786,12 @@ symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe,
/*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);
+
/* free the filter kinds, if it's not null */
if (filter_kinds_array)
{
@@ -793,11 +799,6 @@ symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe,
g_ptr_array_free (filter_kinds_array, TRUE);
}
- /* 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);
-
if (!GDA_IS_DATA_MODEL (data) ||
gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
{
@@ -1046,6 +1047,12 @@ symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe,
MP_SET_HOLDER_BATCH_INT(priv, param, scope_parent_symbol_id, 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, NULL);
+
/* free the filter kinds, if it's not null */
if (filter_kinds_array)
{
@@ -1053,11 +1060,6 @@ symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe,
g_ptr_array_free (filter_kinds_array, TRUE);
}
- /* 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);
-
if (!GDA_IS_DATA_MODEL (data) ||
gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
{
@@ -2465,6 +2467,11 @@ symbol_db_engine_find_symbol_by_name_pattern_on_file (SymbolDBEngine *dbe,
/*DEBUG_PRINT ("query: %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);
+
/* free the filter kinds, if it's not null */
if (filter_kinds_array)
{
@@ -2472,11 +2479,6 @@ symbol_db_engine_find_symbol_by_name_pattern_on_file (SymbolDBEngine *dbe,
g_ptr_array_free (filter_kinds_array, TRUE);
}
- /* 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);
-
if (!GDA_IS_DATA_MODEL (data) ||
gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
{
@@ -2854,6 +2856,7 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
{
gchar *curr_str = g_strdup_printf ("filter%d", i);
param = gda_set_get_holder ((GdaSet*)dyn_node->plist, curr_str);
+ DEBUG_PRINT ("adding type %s", g_ptr_array_index (filter_kinds_array, i));
MP_SET_HOLDER_BATCH_STR(priv, param, g_ptr_array_index (filter_kinds_array, i),
ret_bool, ret_value);
g_free (curr_str);
@@ -2889,6 +2892,11 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
/*DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %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);
+
/* free the filter kinds, if it's not null */
if (filter_kinds_array)
{
@@ -2896,11 +2904,6 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
g_ptr_array_free (filter_kinds_array, TRUE);
}
- /* 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);
-
if (!GDA_IS_DATA_MODEL (data) ||
gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
{
diff --git a/plugins/symbol-db/test-queries/main.c b/plugins/symbol-db/test-queries/main.c
index 5b5fc3e..200f64e 100644
--- a/plugins/symbol-db/test-queries/main.c
+++ b/plugins/symbol-db/test-queries/main.c
@@ -10,6 +10,40 @@ static void on_single_file_scan_end (SymbolDBEngine* engine, GPtrArray* files)
}
static void
+find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe)
+{
+ SymbolDBEngineIterator *iter;
+ DEBUG_PRINT ("");
+
+ iter = symbol_db_engine_find_symbol_by_name_pattern_filtered (dbe,
+ "TwoC",
+ TRUE,
+ SYMTYPE_MAX,
+ TRUE,
+ SYMSEARCH_FILESCOPE_IGNORE,
+ NULL,
+ -1,
+ -1,
+ SYMINFO_SIMPLE);
+
+ if (iter == NULL)
+ {
+ g_warning ("Iterator null");
+ return;
+ }
+
+ do {
+ SymbolDBEngineIteratorNode *node;
+
+ node = SYMBOL_DB_ENGINE_ITERATOR_NODE (iter);
+
+ DEBUG_PRINT ("node name %s",
+ symbol_db_engine_iterator_node_get_symbol_name (node));
+
+ } while (symbol_db_engine_iterator_move_next (iter) == TRUE);
+}
+
+static void
get_scope_members_by_path (SymbolDBEngine* dbe)
{
GPtrArray *array;
@@ -45,13 +79,13 @@ get_scope_members_by_path (SymbolDBEngine* dbe)
g_ptr_array_free (array, TRUE);
}
-
static void
do_test_queries (SymbolDBEngine* dbe)
{
+
+// get_scope_members_by_path (dbe);
- get_scope_members_by_path (dbe);
-
+ find_symbol_by_name_pattern_filtered (dbe);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]