SQL Queries - CAST Management Base - How to check for overlapping user-defined source folders by technology

Purpose of Query

This query when ran on the CAST management base will provide the list of user-defined source folders for a given technology, ordered by file types in alphabetical order

You just have to compare the folders and see if there are some overlap on the others.

Please note that this query will have empty results if no source include folder were manually configured by the user.
In this case you should compare the rootpath of the analysis units using the following query instead : SQL Queries - CAST Management Base - How to check for overlapping analysis units by technology

A pre-requisite is to identify the table you will use, depending on the technology :

In management base, for each technology you have one table containing the analysis units.

Their names are CMS_<TECHNO>_ANALYSIS.

For instance, for Java you have table CMS_J2EE_ANALYSIS.

For .Net you have CMS_NET_ANALYSIS.

For C++ you have CMS_CPP_ANALYSIS.

Applicable CAST Version
Release
Yes/No
8.3.x(tick)
Applicable RDBMS
RDBMS
Yes/No
CSS(tick)
Query for CSS, Oracle, and SQL server
How to check for overlapping source folders (here it is JAVA case)
SELECT cja.object_name AS AnalysisUnitName, 
       CCS.path, 
       CO.symbol      AS CustomIncludePath 
FROM   cms_objectlinks CO 
       JOIN cms_code_sourcefolder CCS 
         ON CCS.object_id = CO.callee_id 
       JOIN cms_j2ee_analysis cja 
         ON cja.object_id = CO.caller_id 
ORDER  BY CO.symbol, 
          CCS.path 
Query result example

"MyAppMobileWeb";"S:\Sources\MyApp\Analyzed\DSS\MF_code\app";"clientFiles"

"MyAppMobileWeb";"S:\Sources\MyApp\Analyzed\DSS\MF_code\app\js";"clientFiles"

"MyWorldShopDataTypes";"S:\Sources\MyApp\Analyzed\XXXX\MyWorldShopDataTypes";"javaFiles"

"XXXXWebAppStruts1.1Analyzed";"S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp\src";"javaFiles"

"XXXXWebAppStruts1.1Analyzed";"S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp";"propertyFiles"

"main3";"S:\Sources\MyApp\Analyzed\SL\sl_core\main";"propertyFiles"

"main1";"S:\Sources\MyApp\Analyzed\SL\sl_core\main";"propertyFiles"

"main2";"S:\Sources\MyApp\Analyzed\SL\sl_core\main";"propertyFiles"

"LoggingServerHelperUtil";"S:\Sources\MyApp\Analyzed\XXXX\LoggingServerHelperUtil";"xmlFiles"

"XXXXWebAppStruts1.1Analyzed";"S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp";"xmlFiles"

"XXXXWebAppStruts1.1Analyzed";"S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp";"xmlFiles"

"XXXXWebApp";"S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp\WebContent";"xmlFiles"

Query result interpretation
  • Category "clientFiles" : you see that the two source folders are overlapping, since "S:\Sources\MyApp\Analyzed\DSS\MF_code\app\js" is incuded in "S:\Sources\MyApp\Analyzed\DSS\MF_code\app" 
  • Category "javaFiles" : no overlap
  • Category "propertyFiles" : you see that "main1", main2" and "main3" are overlapping, since they are pointing to the same folder : "S:\Sources\MyApp\Analyzed\SL\sl_core\main"
  • Category "xmlFiles" : you see that two folders are overlapping since they are pointing to the same folder : "S:\Sources\MyApp\Analyzed\XXXX\XXXXWebApp"
Notes/comments