aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/resources
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-08-06 14:05:00 -0500
committerSonarTech <sonartech@sonarsource.com>2019-09-24 20:21:13 +0200
commit14bd90f47ee950d4ee780cbd2a030cac5cb034c0 (patch)
tree1f1e18d6de8074f01f0670369e28e817f6490267 /server/sonar-db-dao/src/main/resources
parent09f8f0f6ca0fab099775351385b1dfbe96bc6e5f (diff)
downloadsonarqube-14bd90f47ee950d4ee780cbd2a030cac5cb034c0.tar.gz
sonarqube-14bd90f47ee950d4ee780cbd2a030cac5cb034c0.zip
SONAR-12364 Fix update of values
Diffstat (limited to 'server/sonar-db-dao/src/main/resources')
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/newcodeperiod/NewCodePeriodMapper.xml22
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml2
2 files changed, 18 insertions, 6 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/newcodeperiod/NewCodePeriodMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/newcodeperiod/NewCodePeriodMapper.xml
index 17371e37d22..8ec1e59cf75 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/newcodeperiod/NewCodePeriodMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/newcodeperiod/NewCodePeriodMapper.xml
@@ -51,11 +51,23 @@
value=#{value, jdbcType=VARCHAR},
updated_at=#{updatedAt, jdbcType=TIMESTAMP}
WHERE
- uuid=#{uuid, jdbcType=VARCHAR}
- OR
- (project_uuid=#{projectUuid, jdbcType=VARCHAR}
+ <choose>
+ <when test="projectUuid != null">
+ project_uuid=#{projectUuid, jdbcType=VARCHAR}
+ </when>
+ <otherwise>
+ project_uuid IS NULL
+ </otherwise>
+ </choose>
AND
- branch_uuid=#{branchUuid, jdbcType=VARCHAR})
+ <choose>
+ <when test="branchUuid != null">
+ branch_uuid=#{branchUuid, jdbcType=VARCHAR}
+ </when>
+ <otherwise>
+ branch_uuid IS NULL
+ </otherwise>
+ </choose>
</update>
<select id="selectByProject" parameterType="map" resultType="org.sonar.db.newcodeperiod.NewCodePeriodDto">
@@ -76,7 +88,7 @@
AND ncp.branch_uuid=#{branchUuid, jdbcType=VARCHAR}
</select>
- <update id="deleteByProjectAndBranch" parameterType="map">
+ <update id="deleteByBranch" parameterType="map">
DELETE
FROM new_code_periods
WHERE
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
index 1bc48d06dc7..3532d494fc4 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
@@ -44,7 +44,7 @@
and not exists(select e.id from events e where e.analysis_uuid=s.uuid)
</select>
- <select id="selectManualBaseline" parameterType="String" resultType="String">
+ <select id="selectSpecificAnalysisNewCodePeriod" parameterType="String" resultType="String">
select
value
from