SQL Queries - CAST Knowledge Base - Queries on jobs - How to get the list of artifacts and their cyclomatic complexity inside an execution unit

Purpose of Query

This document provides a query to get the list of artifacts contained in a given execution unit, as well as their cyclomatic complexity.

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 DISTINCT daa.object_id ,
                ots.objtypstr    ,
                daa.code_lines   ,
                daa.comment_lines,
                daa.coupling     ,
                daa.fan_in       ,
                daa.fan_out      ,
                daa.cyclomatic
FROM            dssapp_artifacts daa
                JOIN keys k2
                ON              k2.idkey = daa.object_id
                JOIN objtypstr ots
                ON              ots.objtyp=k2.objtyp
                JOIN objpro op
                ON              op.idobj=k2.idkey
                JOIN anapro ap
                ON              ap.idpro=op.idpro
                JOIN anajob aj
                ON              aj.idjob=ap.idjob
WHERE           aj.jobnam               ='<EXECUTION_UNIT_NAME>'
ORDER BY        cyclomatic DESC
Query result example

136699;"C# Method";46;18;1;0;2;21
158448;"C# Method";36;19;1;0;2;16
86641;"C# Method";34;21;1;0;2;15
106823;"C# Method";22;12;1;0;1;9
60886;"C# Constructor";6;3;2;1;2;1
73290;"C# Constructor";4;5;5;4;2;1
76634;"C# Constructor";3;3;1;0;1;1
85360;"C# Constructor";5;6;2;1;3;1
86613;"C# Constructor";3;4;2;1;1;1
173150;"C# Method";5;6;1;0;3;1

Query result interpretation

This execution unit contains the listed artifacts, with details, sorted by cyclomatic complexity in descending order.



Query for Oracle
SELECT DISTINCT daa.object_id ,
                ots.objtypstr    ,
                daa.code_lines   ,
                daa.comment_lines,
                daa.coupling     ,
                daa.fan_in       ,
                daa.fan_out      ,
                daa.cyclomatic
FROM            dssapp_artifacts daa
                JOIN keys k2
                ON              k2.idkey = daa.object_id
                JOIN objtypstr ots
                ON              ots.objtyp=k2.objtyp
                JOIN objpro op
                ON              op.idobj=k2.idkey
                JOIN anapro ap
                ON              ap.idpro=op.idpro
                JOIN anajob aj
                ON              aj.idjob=ap.idjob
WHERE           aj.jobnam               ='<EXECUTION_UNIT_NAME>'
ORDER BY        cyclomatic DESC
Query result example

136699;"C# Method";46;18;1;0;2;21
158448;"C# Method";36;19;1;0;2;16
86641;"C# Method";34;21;1;0;2;15
106823;"C# Method";22;12;1;0;1;9
60886;"C# Constructor";6;3;2;1;2;1
73290;"C# Constructor";4;5;5;4;2;1
76634;"C# Constructor";3;3;1;0;1;1
85360;"C# Constructor";5;6;2;1;3;1
86613;"C# Constructor";3;4;2;1;1;1
173150;"C# Method";5;6;1;0;3;1

Query result interpretation

This execution unit contains the listed artifacts, with details, sorted by cyclomatic complexity in descending order



Query for SQL server
SELECT DISTINCT daa.object_id    ,
                ots.objtypstr    ,
                daa.code_lines   ,
                daa.comment_lines,
                daa.coupling     ,
                daa.fan_in       ,
                daa.fan_out      ,
                daa.cyclomatic
FROM            dssapp_artifacts daa
                JOIN keys k2
                ON              k2.idkey = daa.object_id
                JOIN objtypstr ots
                ON              ots.objtyp=k2.objtyp
                JOIN objpro op
                ON              op.idobj=k2.idkey
                JOIN anapro ap
                ON              ap.idpro=op.idpro
                JOIN anajob aj
                ON              aj.idjob=ap.idjob
WHERE           aj.jobnam               ='<EXECUTION_UNIT_NAME>'
ORDER BY        cyclomatic DESC

Query result example

136699;"C# Method";46;18;1;0;2;21
158448;"C# Method";36;19;1;0;2;16
86641;"C# Method";34;21;1;0;2;15
106823;"C# Method";22;12;1;0;1;9
60886;"C# Constructor";6;3;2;1;2;1
73290;"C# Constructor";4;5;5;4;2;1
76634;"C# Constructor";3;3;1;0;1;1
85360;"C# Constructor";5;6;2;1;3;1
86613;"C# Constructor";3;4;2;1;1;1
173150;"C# Method";5;6;1;0;3;1

Query result interpretation

This execution unit contains the listed artifacts, with details, sorted by cyclomatic complexity in descending order.

Notes/comments

Related Pages