SQL Queries - CAST Central Base - Queries on source code - How to get source code of an object

Purpose of Query

The purpose of this page is to provide a query which can provide the source code for a given object fullname

Applicable CAST Version

ReleaseYes/No
8.3.x
8.2.x

Applicable RDBMS

RDBMSYes/No
Oracle Server
Microsoft SQL Server
CSS3
CSS2

Query for CSS

Run the query below on the central database replacing XXX by part of the object fullname (case sensitive field):

SELECT dsp.panel       ,
       dst.source_path ,
       dst.source_text ,
       dsp.start_line  ,
       dsp.end_line    ,
       dsp.start_column,
       dsp.end_column  ,
       dso.object_full_name
FROM   dss_source_positions dsp
       JOIN dss_objects dso
       ON     dso.object_id = dsp.object_id
       JOIN dss_source_texts dst
       ON     dst.local_source_id=dsp.local_source_id
WHERE  dso.object_full_name   LIKE '%XXX%'

Query result example

2375,‘C:\CASTMS\test830_css3\Deploy\webgoat\webgoat\JavaSource\org\owasp\webgoat\lessons\GoatHillsFinancial\Logout.java’,’’,11,76,1,2,‘org.owasp.webgoat.lessons.GoatHillsFinancial.Logout’

Query result interpretation

The query provides the panel id, source path, source, start and end lines, start and end columns, and object fullname

Query for Oracle

Enter the SQL query

Query result example

Query result interpretation

Query for SQL server

Enter the SQL query

Query result example

Query result interpretation

Notes/comments

Related Pages