[anjuta] symbol-db: Implement has-child in sql queries
- From: Naba Kumar <naba src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: Implement has-child in sql queries
- Date: Fri, 9 Apr 2010 20:20:38 +0000 (UTC)
commit b303f3889f661befe8d49f30bf082394acfd7b7d
Author: Naba Kumar <naba gnome org>
Date: Fri Apr 9 00:20:56 2010 +0300
symbol-db: Implement has-child in sql queries
plugins/symbol-db/symbol-db-model-file.c | 8 +++++++-
plugins/symbol-db/symbol-db-model-project.c | 15 ++++++++++++---
plugins/symbol-db/symbol-db-model-project.h | 1 +
3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-model-file.c b/plugins/symbol-db/symbol-db-model-file.c
index 3a73d44..c366b71 100644
--- a/plugins/symbol-db/symbol-db-model-file.c
+++ b/plugins/symbol-db/symbol-db-model-file.c
@@ -33,7 +33,13 @@
sym_access.access_name, \
sym_type.type_type, \
sym_type.type_name, \
- sym_kind.kind_name \
+ sym_kind.kind_name, \
+ (symbol.kind_id IN \
+ ( \
+ SELECT sym_kind_id \
+ FROM sym_kind \
+ WHERE kind_name IN ('class', 'namespace', 'enum', 'struct', 'union') \
+ )) AS has_child \
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 \
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index e000c9d..254c734 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -33,7 +33,13 @@
sym_access.access_name, \
sym_type.type_type, \
sym_type.type_name, \
- sym_kind.kind_name \
+ sym_kind.kind_name, \
+ (symbol.kind_id IN \
+ ( \
+ SELECT sym_kind_id \
+ FROM sym_kind \
+ WHERE kind_name IN ('class', 'namespace', 'enum', 'struct', 'union') \
+ )) AS has_child \
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 \
@@ -85,6 +91,7 @@ enum {
DATA_COL_SYMBOL_TYPE,
DATA_COL_SYMBOL_TYPE_NAME,
DATA_COL_SYMBOL_KIND_NAME,
+ DATA_COL_SYMBOL_HAS_CHILD,
DATA_N_COLS
};
@@ -159,7 +166,7 @@ sdb_model_project_get_has_child (SymbolDBModel *model, gint tree_level,
GValue column_values[])
{
return (g_value_get_int
- (&column_values[SYMBOL_DB_MODEL_PROJECT_COL_SCOPE_DEFINITION_ID]) > 0);
+ (&column_values[SYMBOL_DB_MODEL_PROJECT_COL_HAS_CHILD]) > 0);
}
static gint
@@ -411,6 +418,7 @@ sdb_model_project_init (SymbolDBModelProject *object)
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_STRING,
+ G_TYPE_INT,
G_TYPE_INT
};
@@ -421,7 +429,8 @@ sdb_model_project_init (SymbolDBModelProject *object)
DATA_COL_SYMBOL_FILE_PATH,
DATA_COL_SYMBOL_FILE_LINE,
DATA_COL_SYMBOL_ARGS,
- DATA_COL_SYMBOL_SCOPE_DEFINITION_ID
+ DATA_COL_SYMBOL_SCOPE_DEFINITION_ID,
+ DATA_COL_SYMBOL_HAS_CHILD
};
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (object));
diff --git a/plugins/symbol-db/symbol-db-model-project.h b/plugins/symbol-db/symbol-db-model-project.h
index 816bbb1..20723fa 100644
--- a/plugins/symbol-db/symbol-db-model-project.h
+++ b/plugins/symbol-db/symbol-db-model-project.h
@@ -44,6 +44,7 @@ enum {
SYMBOL_DB_MODEL_PROJECT_COL_LINE,
SYMBOL_DB_MODEL_PROJECT_COL_ARGS,
SYMBOL_DB_MODEL_PROJECT_COL_SCOPE_DEFINITION_ID,
+ SYMBOL_DB_MODEL_PROJECT_COL_HAS_CHILD,
SYMBOL_DB_MODEL_PROJECT_COL_N_COLS
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]