Purpose

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.

Applicable in 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)

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 -


  1. 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>
  2. 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) -

  1. 7108 ABAP: Avoid Artifacts with a Complex SELECT Clause

  2. 662 C++: Avoid Functions/Methods with a complex SELECT clause

  3. 1116 C: Avoid Functions with a complex SELECT clause

  4. 5132 COBOL: Avoid Programs with a Complex SELECT Clause

  5. 6612SQL-PSM: Avoid Functions/Procedures with a complex SELECT clause

  6. 1644 PL/SQL: Avoid Functions/Procedures with a complex SELECT clause

  7. 4776 Java: Avoid Artifacts with a complex SELECT clause

  8. 6178 PB: Avoid Artifacts with a Complex SELECT Clause

  9. 4140 T-SQL: Avoid Functions/Procedures with a complex SELECT clause

  10. 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