SQL Queries - Common SQL Queries - Queries on Metrics - How to get information on activated or enabled quality rules
Purpose of Query
This query when executed on a central or a local database will provide information on activated or enabled quality rules.
Applicable CAST Version
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
| 8.2.x | ✅ |
Applicable RDBMS
| RDBMS | Yes/No |
|---|---|
| Oracle Server | ❓ |
| Microsoft SQL Server | ❓ |
| CSS | ✅ |
Query for CSS
SELECT COALESCE(tech.TECHNO_TYPE_NAME, 'AllTechno' ) AS technology_name ,
COALESCE(PT.OBJECT_TYPE_ID,0) AS technology_id ,
T.METRIC_ID ,
T.METRIC_NAME ,
TT.METRIC_SCOPE_PROCEDURE_NAME AS detailed_proc_name ,
VT.METRIC_VALUE_PROCEDURE_NAME AS total_proc_name
FROM DSS_METRIC_TYPE_TREES TT ,
DSS_METRIC_VALUE_TYPES VT,
DSS_METRIC_TYPES T
LEFT OUTER JOIN DSS_METRIC_PARAM_TYPES PT
ON PT.METRIC_ID = T.METRIC_ID
AND PT.PARAM_INDEX = 1
LEFT OUTER JOIN DSS_TECHNO_DISPLAY_VW tech
ON tech.TECHNO_TYPE_ID = PT.OBJECT_TYPE_ID
WHERE T.METRIC_GROUP = 1
AND T.METRIC_TYPE != 0 -- Not Deleted
AND TT.METRIC_ID = T.METRIC_ID + 1
AND VT.METRIC_ID = T.METRIC_ID
AND VT.METRIC_VALUE_INDEX = 2
AND EXISTS
( SELECT 1
FROM DSS_METRIC_TYPE_TREES x
WHERE x.METRIC_ID = T.METRIC_ID
)
AND T.METRIC_ID IN (<your_metric_ids>)
Query result example
“JEE”;140029;7722;“Avoid using references to the id in the persistent class’s method equals()”;“DIAG_SCOPE_JEEPPUB004”;“DIAG_JEE_PERSEQUALS_TOTAL”
“C++”;-3;7932;“Avoid Constructors not supplying an initial value for all non-static data members”;“DSS_DIAG_SCOPE_GENERIC_NUM”;“DSS_DIAG_TOTAL_GENERIC”
Query result interpretation
Metric id must be provided and then the results for the metric id will be generated if the rule is enabled or activated.
The query result will list the technology associated with the rule, the metric id, the metric name, the detailed procedure name, and the total procedure name.
Query for Oracle
Enter the SQL query
Query result example
Query result interpretation
Query for SQL server
Enter the SQL query
Query result example
Query result interpretation
Notes/comments
Related Pages