SQL Queries - CAST Knowledge Base - Queries on jobs - How to get the list of all the categories that an object type belongs to

Purpose of Query

This document provides a query to get the list of categories an object type belongs to. This is useful when you want to know if an object will be implied in a metrics calculation or in a diag calculation, knowing its object type

Applicable CAST Version
Release
Yes/No
8.3.x (tick) 
8.2.x (tick) 
Applicable RDBMS
RDBMS
Yes/No
Oracle Server (tick) 
Microsoft SQL Server (tick) 
CSS (tick) 
Query for CSS
SELECT   c.*
FROM     TypCat tc,
         Cat c
WHERE    tc.IdTyp       = <OBJECT_TYPE_ID> -- 102 for Java Method for example
AND      tc.IdCatParent = c.IdCat
ORDER BY CatNam

Query result example

10046;"APM All Artifacts";"All Artifacts";"ACTIVE "
10045;"APM All Language Artifacts";"All Language Artifacts";"ACTIVE "
10044;"APM Client Language Artifacts";"Client Language Artifacts";"ACTIVE "
10062;"APM Client-Server Artifacts";"Client-Server Artifacts";"ACTIVE "
10051;"APM Inventory Methods";"Inventory Methods";"ACTIVE "
10034;"APM Java All";"Java All objects _ classes and subs";"ACTIVE "
10029;"APM Java Artifacts";"Java Artifacts";"ACTIVE "
10008;"APM Java Methods";"Java Methods";"ACTIVE "
10028;"APM Methods";"Methods";"ACTIVE "
141810;"CAST_AvoidDatabaseResourceLeaks";"Close database resources ASAP";"ACTIVE "
141963;"CAST_AvoidSQLCallWithoutExceptionHandling";"SQL Call without Exception Handling";"ACTIVE "
141815;"CAST_AvoidStreamResourceLeaks";"Close database resources ASAP";"ACTIVE "
141807;"CAST_AvoidSynchronousCallsLackTimeouts";"synchronous calls that lack associated timeouts";"ACTIVE "
141804;"CAST_AvoidTestingFloatingPointNumbersForEquality";"Avoid testing floating point numbers for equality";"ACTIVE "
141931;"CAST_AvoidTooManySQLCalls";"Number of SQL calls within a method";"ACTIVE "
141917;"CAST_AvoidUsingHashTable";"Avoid using HashTable";"ACTIVE "
140096;"CAST_CodeGeneration_ParametersEmitted";"Posted when the parameters of a symbol have been emitted";"ACTIVE "
138084;"CAST_CodeViewable";"Used to identify the objects whose code can be viewed through portals";"ACTIVE "
141305;"CAST_DevelopmentVisible";"Objects appearing in the Developement view";"ACTIVE "
137459;"CAST_Guid_FatherReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137608;"CAST_Guid_ProjectReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137559;"CAST_Java_AnnotationMetrics";"Metric about Java annotations";"ACTIVE "
141542;"CAST_Java_DefinedInCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141547;"CAST_Java_IdentifierPositions";"Line and column of the symbol identifier";"ACTIVE "
137556;"CAST_Java_JavaDoc";"JavaDoc comments";"ACTIVE "
140215;"CAST_Java_KB_Object";"Represent a Java symbol that can be persisted";"ACTIVE "
141543;"CAST_Java_LastValidCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141621;"CAST_Java_Main_Objects";"CAST-27016 : Add a new Category to identify main Java Objects (as opposed to EJB, JSP, etc)";"ACTIVE "
138403;"CAST_Java_Method";"Java All Methods";"ACTIVE "
141549;"CAST_Java_MethodLinkSuspension";"Link suspensions of a methods";"ACTIVE "
137560;"CAST_Java_MethodsMetrics";"Metric computed on Methods, Constructors or Initializers by Analyzer";"ACTIVE "
141633;"CAST_Java_Metric_avoidInstantiationsInsideLoops";"CAST_Java_Metric_avoidInstantiationsInsideLoops";"ACTIVE "
141410;"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"ACTIVE "

Query result interpretation

This object type is a member of all the listed categories. It can have an impact on all metrics and diags calculations using these categories



Query for Oracle
SELECT   c.*
FROM     TypCat tc,
         Cat c
WHERE    tc.IdTyp       = <OBJECT_TYPE_ID> -- 102 for Java Method for example
AND      tc.IdCatParent = c.IdCat
ORDER BY CatNam

Query result example

10046;"APM All Artifacts";"All Artifacts";"ACTIVE "
10045;"APM All Language Artifacts";"All Language Artifacts";"ACTIVE "
10044;"APM Client Language Artifacts";"Client Language Artifacts";"ACTIVE "
10062;"APM Client-Server Artifacts";"Client-Server Artifacts";"ACTIVE "
10051;"APM Inventory Methods";"Inventory Methods";"ACTIVE "
10034;"APM Java All";"Java All objects _ classes and subs";"ACTIVE "
10029;"APM Java Artifacts";"Java Artifacts";"ACTIVE "
10008;"APM Java Methods";"Java Methods";"ACTIVE "
10028;"APM Methods";"Methods";"ACTIVE "
141810;"CAST_AvoidDatabaseResourceLeaks";"Close database resources ASAP";"ACTIVE "
141963;"CAST_AvoidSQLCallWithoutExceptionHandling";"SQL Call without Exception Handling";"ACTIVE "
141815;"CAST_AvoidStreamResourceLeaks";"Close database resources ASAP";"ACTIVE "
141807;"CAST_AvoidSynchronousCallsLackTimeouts";"synchronous calls that lack associated timeouts";"ACTIVE "
141804;"CAST_AvoidTestingFloatingPointNumbersForEquality";"Avoid testing floating point numbers for equality";"ACTIVE "
141931;"CAST_AvoidTooManySQLCalls";"Number of SQL calls within a method";"ACTIVE "
141917;"CAST_AvoidUsingHashTable";"Avoid using HashTable";"ACTIVE "
140096;"CAST_CodeGeneration_ParametersEmitted";"Posted when the parameters of a symbol have been emitted";"ACTIVE "
138084;"CAST_CodeViewable";"Used to identify the objects whose code can be viewed through portals";"ACTIVE "
141305;"CAST_DevelopmentVisible";"Objects appearing in the Developement view";"ACTIVE "
137459;"CAST_Guid_FatherReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137608;"CAST_Guid_ProjectReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137559;"CAST_Java_AnnotationMetrics";"Metric about Java annotations";"ACTIVE "
141542;"CAST_Java_DefinedInCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141547;"CAST_Java_IdentifierPositions";"Line and column of the symbol identifier";"ACTIVE "
137556;"CAST_Java_JavaDoc";"JavaDoc comments";"ACTIVE "
140215;"CAST_Java_KB_Object";"Represent a Java symbol that can be persisted";"ACTIVE "
141543;"CAST_Java_LastValidCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141621;"CAST_Java_Main_Objects";"CAST-27016 : Add a new Category to identify main Java Objects (as opposed to EJB, JSP, etc)";"ACTIVE "
138403;"CAST_Java_Method";"Java All Methods";"ACTIVE "
141549;"CAST_Java_MethodLinkSuspension";"Link suspensions of a methods";"ACTIVE "
137560;"CAST_Java_MethodsMetrics";"Metric computed on Methods, Constructors or Initializers by Analyzer";"ACTIVE "
141633;"CAST_Java_Metric_avoidInstantiationsInsideLoops";"CAST_Java_Metric_avoidInstantiationsInsideLoops";"ACTIVE "
141410;"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"ACTIVE "

Query result interpretation

All these objects were created during the analysis of this execution unit.

It can be useful to know if two objects were analyzed in the same execution unit, in case of missing links for example.

Query for SQL server
Query for CSS
SELECT   c.*
FROM     TypCat tc,
         Cat c
WHERE    tc.IdTyp       = <OBJECT_TYPE_ID> -- 102 for Java Method for example
AND      tc.IdCatParent = c.IdCat
ORDER BY CatNam

Query result example

10046;"APM All Artifacts";"All Artifacts";"ACTIVE "
10045;"APM All Language Artifacts";"All Language Artifacts";"ACTIVE "
10044;"APM Client Language Artifacts";"Client Language Artifacts";"ACTIVE "
10062;"APM Client-Server Artifacts";"Client-Server Artifacts";"ACTIVE "
10051;"APM Inventory Methods";"Inventory Methods";"ACTIVE "
10034;"APM Java All";"Java All objects _ classes and subs";"ACTIVE "
10029;"APM Java Artifacts";"Java Artifacts";"ACTIVE "
10008;"APM Java Methods";"Java Methods";"ACTIVE "
10028;"APM Methods";"Methods";"ACTIVE "
141810;"CAST_AvoidDatabaseResourceLeaks";"Close database resources ASAP";"ACTIVE "
141963;"CAST_AvoidSQLCallWithoutExceptionHandling";"SQL Call without Exception Handling";"ACTIVE "
141815;"CAST_AvoidStreamResourceLeaks";"Close database resources ASAP";"ACTIVE "
141807;"CAST_AvoidSynchronousCallsLackTimeouts";"synchronous calls that lack associated timeouts";"ACTIVE "
141804;"CAST_AvoidTestingFloatingPointNumbersForEquality";"Avoid testing floating point numbers for equality";"ACTIVE "
141931;"CAST_AvoidTooManySQLCalls";"Number of SQL calls within a method";"ACTIVE "
141917;"CAST_AvoidUsingHashTable";"Avoid using HashTable";"ACTIVE "
140096;"CAST_CodeGeneration_ParametersEmitted";"Posted when the parameters of a symbol have been emitted";"ACTIVE "
138084;"CAST_CodeViewable";"Used to identify the objects whose code can be viewed through portals";"ACTIVE "
141305;"CAST_DevelopmentVisible";"Objects appearing in the Developement view";"ACTIVE "
137459;"CAST_Guid_FatherReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137608;"CAST_Guid_ProjectReady";"Used to notify the children about their parent's guid computation";"ACTIVE "
137559;"CAST_Java_AnnotationMetrics";"Metric about Java annotations";"ACTIVE "
141542;"CAST_Java_DefinedInCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141547;"CAST_Java_IdentifierPositions";"Line and column of the symbol identifier";"ACTIVE "
137556;"CAST_Java_JavaDoc";"JavaDoc comments";"ACTIVE "
140215;"CAST_Java_KB_Object";"Represent a Java symbol that can be persisted";"ACTIVE "
141543;"CAST_Java_LastValidCompilationUnit";"Reference on a compilation unit";"ACTIVE "
141621;"CAST_Java_Main_Objects";"CAST-27016 : Add a new Category to identify main Java Objects (as opposed to EJB, JSP, etc)";"ACTIVE "
138403;"CAST_Java_Method";"Java All Methods";"ACTIVE "
141549;"CAST_Java_MethodLinkSuspension";"Link suspensions of a methods";"ACTIVE "
137560;"CAST_Java_MethodsMetrics";"Metric computed on Methods, Constructors or Initializers by Analyzer";"ACTIVE "
141633;"CAST_Java_Metric_avoidInstantiationsInsideLoops";"CAST_Java_Metric_avoidInstantiationsInsideLoops";"ACTIVE "
141410;"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"CAST_Java_Metric_avoidMethodsWithSuspiciousSimilarNamesInInheritanceTree";"ACTIVE "

Query result interpretation

This object type is a member of all the listed categories. It can have an impact on all metrics and diags calculations using these categories.

Notes/comments

Related Pages