[anjuta] symbol-db: Make queries a bit faster



commit 22651128b37ec6694695dfdb70667620d0f0e9c3
Author: Naba Kumar <naba gnome org>
Date:   Fri Apr 9 00:56:53 2010 +0300

    symbol-db: Make queries a bit faster

 plugins/symbol-db/symbol-db-model-file.c    |   24 ++++++++++++++++++------
 plugins/symbol-db/symbol-db-model-project.c |   18 ++++++++++++------
 2 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-model-file.c b/plugins/symbol-db/symbol-db-model-file.c
index c366b71..fbf0623 100644
--- a/plugins/symbol-db/symbol-db-model-file.c
+++ b/plugins/symbol-db/symbol-db-model-file.c
@@ -33,7 +33,6 @@
 		sym_access.access_name, \
 		sym_type.type_type, \
 		sym_type.type_name, \
-		sym_kind.kind_name, \
 		(symbol.kind_id IN \
 		( \
 			SELECT sym_kind_id \
@@ -44,12 +43,16 @@
 	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 \
 	( \
 		file.file_path = ## /* name:'filepath' type:gchararray */ \
 		AND symbol.scope_id = ## /* name:'parent' type:gint */ \
-		AND sym_kind.kind_name != 'namespace' \
+		AND symbol.kind_id NOT IN \
+		( \
+			SELECT sym_kind_id \
+			FROM sym_kind \
+			WHERE sym_kind.kind_name = 'namespace' \
+		) \
 	) \
 	OR \
 	( \
@@ -58,11 +61,15 @@
 			SELECT symbol_id \
 			FROM symbol \
 			LEFT JOIN file ON symbol.file_defined_id = file.file_id \
-			LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id \
 			WHERE \
 				file.file_path = ## /* name:'filepath' type:gchararray */ \
 				AND symbol.scope_id = ## /* name:'parent' type:gint */ \
-				AND sym_kind.kind_name = 'namespace' \
+				AND symbol.kind_id IN \
+				( \
+					SELECT sym_kind_id \
+					FROM sym_kind \
+					WHERE sym_kind.kind_name = 'namespace' \
+				) \
 			GROUP BY symbol.scope_definition_id \
 			\
 		) \
@@ -70,7 +77,12 @@
 	OR \
 	( \
 		symbol.scope_id = ## /* name:'parent' type:gint */ \
-		AND sym_kind.kind_name != 'namespace' \
+		AND symbol.kind_id NOT IN \
+		( \
+			SELECT sym_kind_id \
+			FROM sym_kind \
+			WHERE sym_kind.kind_name = 'namespace' \
+		) \
 		AND symbol.scope_definition_id IN \
 		( \
 			SELECT scope_id \
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index 254c734..25b88f4 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -33,7 +33,6 @@
 		sym_access.access_name, \
 		sym_type.type_type, \
 		sym_type.type_name, \
-		sym_kind.kind_name, \
 		(symbol.kind_id IN \
 		( \
 			SELECT sym_kind_id \
@@ -44,11 +43,15 @@
 	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.scope_id = ## /* name:'parent' type:gint */ \
-		AND sym_kind.kind_name != 'namespace' \
+		AND symbol.kind_id NOT IN \
+		( \
+			SELECT sym_kind_id \
+			FROM sym_kind \
+			WHERE sym_kind.kind_name = 'namespace' \
+		) \
 	) \
 	OR \
 	( \
@@ -57,10 +60,14 @@
 			SELECT symbol_id \
 			FROM symbol \
 			LEFT JOIN file ON symbol.file_defined_id = file.file_id \
-			LEFT JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id \
 			WHERE \
 				symbol.scope_id = ## /* name:'parent' type:gint */ \
-				AND sym_kind.kind_name = 'namespace' \
+				AND symbol.kind_id IN \
+				( \
+					SELECT sym_kind_id \
+					FROM sym_kind \
+					WHERE sym_kind.kind_name = 'namespace' \
+				) \
 			GROUP BY symbol.scope_definition_id \
 			\
 		) \
@@ -90,7 +97,6 @@ enum {
 	DATA_COL_SYMBOL_ACCESS,
 	DATA_COL_SYMBOL_TYPE,
 	DATA_COL_SYMBOL_TYPE_NAME,
-	DATA_COL_SYMBOL_KIND_NAME,
 	DATA_COL_SYMBOL_HAS_CHILD,
 	DATA_N_COLS
 };



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