CAST Engineering Dashboard - Information - Scope - Total checks for quality rule - Avoid Artifacts with a Complex SELECT Clause
Purpose
This page provides information on the scope of the rule Avoid Artifacts with a Complex SELECT Clause.
Applicable in CAST Version
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
| 8.2.x | ✅ |
| 8.1.x | ✅ |
| 8.0.x | ✅ |
| 7.3.x | ✅ |
| 7.2.x | ✅ |
| 7.0.x | ❌ |
Applicable RDBMS
| RDBMS | Yes/No |
|---|---|
| Oracle Server | ✅ |
| Microsoft SQL Server | ✅ |
| CSS2 | ✅ |
| CSS1 | ❌ |
Details
The scope of the rule “Avoid Artifacts with a Complex SELECT Clause” is the artifacts that use SQL artifacts. You can run the below query on Knowledge base by replacing <object_id> with desired objectID to get the database objects linked to it -
select k.IdKey, k.KeyNam, t.*, clt.link_type_name
from ( select distinct T.OBJECT_ID
from TypCat TC
join CTT_OBJECT_APPLICATIONS T
on T.OBJECT_TYPE = TC.IdTyp
and TC.IdCatParent in ( 6100, 6101, 139148, 136996 ) -- database table, view, CAST_PersistenceFrameworkQuery, CAST_PersistentEntity
)Tmp
join Acc A
on A.IdClr = <object_id>
and A.IdCle = Tmp.OBJECT_ID
and A.AccKnd in (0, 4096, 262144, 1048576)
and ( A.Prop & 65536 ) = 0
join Keys k
on k.IdKey = A.IdCle
join typ t
on t.IdTyp = k.ObjTyp
join ctv_link_types clt
on clt.link_type_lo = A.acctyplo
and clt.link_type_hi = A.acctyphi
If the above query returns rows that means the object is linked with database objects
For example :
- if a java method methodA uses an SQL artifact say a select statement with tableA then methodA will have a link to tableA. This is one of the scenarios where an artifact is making a link with an SQL artifact so methodA will come under the scope of this rule.
- There might be a method which does not contain any SQL artifacts yet it is being counted in the total checks. This is because of the fact that there might be a link to any Spring bean entity from that method. Spring bean entity is an object belonging to a Persistence framework(it is used in executing query). Hence, the methods calling this spring bean are always in the total checks.
Notes/comments
Related Pages
CAST Engineering Dashboard - Quality rule - Missing Quality Rule