aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main/resources
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2020-06-08 17:15:43 +0200
committersonartech <sonartech@sonarsource.com>2020-06-26 20:04:57 +0000
commit14d6de3529b12ec0af367e551cf66ac6daae1ca7 (patch)
tree7674e1e94f2991a2f5819eec401dadd4e0eac86e /server/sonar-db-dao/src/main/resources
parent52dea5983fffca49138dec3f8b58ed3160c8d37c (diff)
downloadsonarqube-14d6de3529b12ec0af367e551cf66ac6daae1ca7.tar.gz
sonarqube-14d6de3529b12ec0af367e551cf66ac6daae1ca7.zip
SONAR-13398 fail with 503 api/issues/search WS if needIssueSync is set to true
Diffstat (limited to 'server/sonar-db-dao/src/main/resources')
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml
index 836a428a9fa..982a77009e4 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml
@@ -188,4 +188,27 @@
uuid = #{uuid, jdbcType=VARCHAR}
</update>
+ <select id="doAnyOfComponentsNeedIssueSync" parameterType="map" resultType="short">
+ select
+ case when exists
+ (
+ select pb.project_uuid, pb.need_issue_sync from project_branches pb join components c on pb.project_uuid =
+ c.project_uuid
+ where c.kee in
+ <foreach collection="componentKeys" open="(" close=")" item="componentKey" separator=",">
+ #{componentKey,jdbcType=VARCHAR}
+ </foreach>
+ and pb.need_issue_sync = ${_true}
+ <if test="branch != null">
+ and pb.kee = #{branch,jdbcType=VARCHAR}
+ </if>
+ <if test="pullRequest != null">
+ and pb.kee = #{pullRequest,jdbcType=VARCHAR}
+ </if>
+ )
+ then 1
+ else 0
+ end
+ </select>
+
</mapper>