什么是声纳数据库结构? [英] What is the sonar database structure?

查看:17
本文介绍了什么是声纳数据库结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据以下因素生成月度报告

I am trying to generate a monthly report base on below factor

  1. LoC(代码行)
  2. 遵守规则 %
  3. 评论%
  4. 公开记录的 API %
  5. 安全违规
  6. 违规(不包括信息)
  7. 重复行 %

我试图检查声纳数据库中的实体关系,所有表都是独立的.我不确定我应该从哪个表中获取值以便生成报告.

I tried to check the Entity relation ship in sonar database,all table are independent . I am not sure from which table I should get the value so as to produce the report .

对于下面的提示,查询被提及

For the hints below query is mentioned

提示:

select proj.name as ClassName, -- Class Name for which violation has been found out
       proj.long_name as LongName, -- Long Class Name i.e. with package for which violation has been found out
       rf.failure_level as ErrorLevel, -- Error level of the violation
       rf.message as Violation, -- Cause of Violation 
       rf.line as LineNumber, -- Line number of the class file
       ru.name ViolationName, -- Violation Description
       ru.plugin_name PluginType -- Plugin tool by which this error has been detected i.e. findbug, PMD, etc.
       --  ,ru.description  -- (if violation description is required we can add this column) from projects proj  inner join snapshots snap on  proj.id = snap.project_id inner join rule_failures rf on rf.snapshot_id = snap.id inner join rules ru on ru.id = rf.rule_id

推荐答案

您可以使用下表获得以上信息.

You can get The above Information Using The below table.

1) 项目、快照、指标和 project_measures.其中项目表包含项目名称.并且对于每个项目,在快照表中的特定时间段内创建一个快照 id.然后从快照表中获取快照 id 并搜索它的 projects_measure 表.并使用度量 id 搜索描述属性的值.

1)projects, snapshots , metrics and project_measures. where projects table contain the Projects name . And for each project one snapshot id is created in certain period of time in snapshot table. then from snapshot table take the snapshot id and search it projects_measure table. and search the value of the descibed attribute using metric id.

select distinct proj.name NAME_OF_PROJ, metric.description Description,
                projdesc.value, snap.created_at CREATED_DATE
  from projects proj
    inner join snapshots snap on snap.project_id=proj.id 
  inner join (select max(snap2.created_at) as date_of_creation,id from snapshots snap2 
              where Date(snap2.created_at)   in ('2011-12-20','2012-02-21') 
               and snap2.project_id  in (5507,35252,9807,38954,23018,32390) 
              GROUP BY DAY(snap2.created_at),snap2.project_id ) as Lookup on Lookup.id=snap.id 

  inner join project_measures projdesc on  projdesc.snapshot_id=snap.id 
  inner join metrics metric on  projdesc.metric_id =metric.id 
  where  metric.id in( 1,2...)

这篇关于什么是声纳数据库结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆