aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2017-06-14 13:24:39 +0200
committerEric Hartmann <hartmann.eric@gmail.com>2017-06-14 15:43:13 +0200
commit764185d9211229e5dcafe885cfdcbfbfadf54ce7 (patch)
tree719e8e2046ccdacaedc5e6c14d949d01792915a7 /server/sonar-db-dao
parentbce59a878501872b105e120bc0d8e13494f79aee (diff)
downloadsonarqube-764185d9211229e5dcafe885cfdcbfbfadf54ce7.tar.gz
sonarqube-764185d9211229e5dcafe885cfdcbfbfadf54ce7.zip
SONAR-9427 Improve performance on quality profile changelog
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml10
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java2
2 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml
index 77ebd8602b8..172b7c9a8ea 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml
@@ -5,7 +5,7 @@
<sql id="selectColumns">
qpc.kee as "uuid",
- qpc.qprofile_key as rulesProfileUuid,
+ qpc.rules_profile_uuid as rulesProfileUuid,
qpc.created_at as createdAt,
qpc.user_login as login,
qpc.change_type as changeType,
@@ -16,7 +16,7 @@
insert into qprofile_changes
(
kee,
- qprofile_key,
+ rules_profile_uuid,
created_at,
user_login,
change_type,
@@ -34,7 +34,7 @@
<select id="countForQProfileUuid" resultType="int">
select count(qpc.kee)
from qprofile_changes qpc
- inner join rules_profiles rp on rp.kee = qpc.qprofile_key
+ inner join rules_profiles rp on rp.kee = qpc.rules_profile_uuid
inner join org_qprofiles oqp on oqp.rules_profile_uuid = rp.kee
where
oqp.uuid = #{qProfileUuid, jdbcType=VARCHAR}
@@ -65,7 +65,7 @@
<sql id="sqlSelectByQuery">
select <include refid="selectColumns" />
from qprofile_changes qpc
- inner join rules_profiles rp on rp.kee = qpc.qprofile_key
+ inner join rules_profiles rp on rp.kee = qpc.rules_profile_uuid
inner join org_qprofiles oqp on oqp.rules_profile_uuid = rp.kee
where
oqp.uuid = #{query.profileUuid, jdbcType=VARCHAR}
@@ -80,7 +80,7 @@
<delete id="deleteByRuleProfileUuids" parameterType="String">
delete from qprofile_changes
- where qprofile_key in
+ where rules_profile_uuid in
<foreach collection="ruleProfileUuids" open="(" close=")" item="ruleProfileUuid" separator=",">
#{ruleProfileUuid, jdbcType=VARCHAR}
</foreach>
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
index 944664e7263..3a2f026169b 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
@@ -239,7 +239,7 @@ public class QProfileChangeDaoTest {
private QProfileChangeDto selectChangeByUuid(String uuid) {
Map<String, Object> map = db.selectFirst(dbSession,
- "select kee as \"uuid\", qprofile_key as \"rulesProfileUuid\", created_at as \"createdAt\", user_login as \"login\", change_type as \"changeType\", change_data as \"changeData\" from qprofile_changes where kee='"
+ "select kee as \"uuid\", rules_profile_uuid as \"rulesProfileUuid\", created_at as \"createdAt\", user_login as \"login\", change_type as \"changeType\", change_data as \"changeData\" from qprofile_changes where kee='"
+ uuid + "'");
return new QProfileChangeDto()
.setUuid((String) map.get("uuid"))