The purpose of the page is to describe how to change or parametrize 'the number of columns returned by select clause' to be treated as violation in the metric Avoid Complex Select.
Release | Yes/No |
---|---|
8.3.x | |
8.2.x |
RDBMS | Yes/No |
---|---|
Oracle Server | |
Microsoft SQL Server | |
CSS |
Description:
The default behavior of this metric is: “If select clause is returning more than 9 columns, this will be treated as a violation”.
If the business requirement is to change or parametrize 'the number of columns returned by select clause' to be treated as violation, it can be done as described below -
Modify "C:\Program Files\CAST\<Version of CAST>\configuration\Metrics\Package\SQL Metric\Select9Columns.xml" and change the <THRESHOLD> value as per requirements:
<ADD_ACTION> <MATCH>PLSQL_SELECTMORE</MATCH> <MATCH>OTHERS_SELECTMORE</MATCH> <MATCH>ABAP_OPENSQL_SELECTMORE</MATCH> <THRESHOLD>9</THRESHOLD> <TOKEN>TOKEN_AND_TREE_ELEMENT.TOKEN_VALUE</TOKEN> <SIGNATURE>TOKEN_AND_TREE_ELEMENT.SIGNATURE_VALUE</SIGNATURE> <RESULT_COUNT>VALUE</RESULT_COUNT> </ADD_ACTION>
- Run Analysis + Snapshot
Note
Impact of the above modification -
1.Updating the above XML file, will affect the 'THRESHOLD value in number of columns returned by select clause' in the following quality rule(s) -
7108 ABAP: Avoid Artifacts with a Complex SELECT Clause
662 C++: Avoid Functions/Methods with a complex SELECT clause
1116 C: Avoid Functions with a complex SELECT clause
5132 COBOL: Avoid Programs with a Complex SELECT Clause
6612SQL-PSM: Avoid Functions/Procedures with a complex SELECT clause
1644 PL/SQL: Avoid Functions/Procedures with a complex SELECT clause
4776 Java: Avoid Artifacts with a complex SELECT clause
6178 PB: Avoid Artifacts with a Complex SELECT Clause
4140 T-SQL: Avoid Functions/Procedures with a complex SELECT clause
7222 VB: Avoid Artifacts with a Complex SELECT Clause
2. It will change the results of all the applications whose analysis and snapshot is carried out using this CAST Installation