Gaston Paolo
Gaston Paolo

Reputation: 138

What is the sonar database Query for get Information

I am trying to generate a monthly report base on below factor For de last run build of code.

The information i Need is this: Cyclomatic complexity Value Name Of Proyect ID Proyect Name Of the File resource Date

My query is this one: i have a problem to get the child files of the parent proyect ids

select 
    pr.name, proj.id, snap.ROOT_PROJECT_ID, proj.path, proj.language, proj.name NAME_OF_PROJ, 
    met.description Description, meas.value, 
    to_date('01-Ene-1970','dd-mm-yyyy hh24:mi:ss')+(SUBSTR(SNAP.created_at,0,10)/60/60/24) created, 
    to_date('01-Ene-1970','dd-mm-yyyy hh24:mi:ss')+(SUBSTR(SNAP.BUILD_DATE,0,10)/60/60/24) build_date, 
     snap.QUALIFIER
from 
    snapshots snap,
    project_measures meas,
    metrics met,
    projects proj,
    projects pr
where  
   --snap.scope =  'FIL'   and
    to_date('01-Ene-1970','dd-mm-yyyy hh24:mi:ss')+(SUBSTR(SNAP.BUILD_DATE,0,10)/60/60/24) 
           between to_date('01-04-2016','dd-mm-yyyy') and to_date('30-04-2016','dd-mm-yyyy')
   and snap.id = MEAS.SNAPSHOT_ID 
   and MEAS.METRIC_ID = MET.ID
   and met.id = 10019
   and snap.project_id = proj.id
   and PR.ID = snap.ROOT_PROJECT_ID;

Upvotes: 0

Views: 1662

Answers (1)

G. Ann - SonarSource Team
G. Ann - SonarSource Team

Reputation: 22824

The database is not an API (and may change from version to version without notice!). You should do this using web services, specifically the measures service.

Upvotes: 3

Related Questions