}
public boolean hasAnyIssueSyncTaskPendingOrInProgress(DbSession dbSession) {
- return mapper(dbSession).hasAnyIssueSyncTaskPendingOrInProgress() > 0;
+ return mapper(dbSession).hasAnyIssueSyncTaskPendingOrInProgress();
}
private static CeQueueMapper mapper(DbSession session) {
int deleteByUuid(@Param("uuid") String uuid, @Nullable @Param("deleteIf") DeleteIf deleteIf);
- short hasAnyIssueSyncTaskPendingOrInProgress();
+ boolean hasAnyIssueSyncTaskPendingOrInProgress();
}
and ca.is_last = ${_true}
</select>
- <select id="hasAnyFailedIssueSyncTask" parameterType="map" resultType="short">
+ <sql id="hasAnyFailedIssueSyncTaskSql">
select
case when exists
(
- select ca.uuid from ce_activity ca where ca.task_type = 'ISSUE_SYNC' and status = 'FAILED'
- and exists(select pb.uuid from project_branches pb where ca.component_uuid = pb.uuid and pb.need_issue_sync = ${_true})
+ select ca.uuid from ce_activity ca inner join project_branches pb on ca.component_uuid = pb.uuid
+ where ca.task_type = 'ISSUE_SYNC'
+ and ca.status = 'FAILED'
+ and pb.need_issue_sync = ${_true}
)
then 1
else 0
end
+ </sql>
+
+ <select id="hasAnyFailedIssueSyncTask" parameterType="map" resultType="short" >
+ <include refid="hasAnyFailedIssueSyncTaskSql"/>
+ </select>
+
+ <select id="hasAnyFailedIssueSyncTask" parameterType="map" resultType="short" databaseId="oracle">
+ <include refid="hasAnyFailedIssueSyncTaskSql"/>
+ from dual
</select>
<select id="selectByTaskType" parameterType="map" resultType="org.sonar.db.ce.CeActivityDto">
) as query
where
query.number between #{pagination.startRowNumber,jdbcType=INTEGER} and #{pagination.endRowNumber,jdbcType=INTEGER}
- <include refid="orderBySelectEligibleForPeek"/>
+ order by number asc
</select>
<select id="selectEligibleForPeek" parameterType="map" resultType="String" databaseId="oracle">
status = 'IN_PROGRESS'
</update>
- <select id="hasAnyIssueSyncTaskPendingOrInProgress" parameterType="map" resultType="short">
+ <sql id="hasAnyIssueSyncTaskPendingOrInProgressSql">
select
case when exists
(
then 1
else 0
end
+ </sql>
+
+ <select id="hasAnyIssueSyncTaskPendingOrInProgress" parameterType="map" resultType="boolean">
+ <include refid="hasAnyIssueSyncTaskPendingOrInProgressSql"/>
+ </select>
+
+ <select id="hasAnyIssueSyncTaskPendingOrInProgress" parameterType="map" resultType="boolean" databaseId="oracle">
+ <include refid="hasAnyIssueSyncTaskPendingOrInProgressSql"/>
+ from dual
</select>
</mapper>
and pb.created_at >= #{sinceDate, jdbcType=BIGINT}
</select>
- <select id="hasAnyBranchWhereNeedIssueSync" parameterType="map" resultType="short">
+ <sql id="hasAnyBranchWhereNeedIssueSyncSql">
select
case when exists
(
then 1
else 0
end
+ </sql>
+
+ <select id="hasAnyBranchWhereNeedIssueSync" parameterType="map" resultType="short">
+ <include refid="hasAnyBranchWhereNeedIssueSyncSql"/>
+ </select>
+
+ <select id="hasAnyBranchWhereNeedIssueSync" parameterType="map" resultType="short" databaseId="oracle">
+ <include refid="hasAnyBranchWhereNeedIssueSyncSql"/>
+ from dual
</select>
<select id="countByNeedIssueSync" parameterType="map" resultType="int">
uuid = #{uuid, jdbcType=VARCHAR}
</update>
- <select id="doAnyOfComponentsNeedIssueSync" parameterType="map" resultType="short">
+ <sql id="doAnyOfComponentsNeedIssueSyncSql">
select
case when exists
(
then 1
else 0
end
+ </sql>
+
+ <select id="doAnyOfComponentsNeedIssueSync" parameterType="map" resultType="short">
+ <include refid="doAnyOfComponentsNeedIssueSyncSql"/>
+ </select>
+
+ <select id="doAnyOfComponentsNeedIssueSync" parameterType="map" resultType="short" databaseId="oracle">
+ <include refid="doAnyOfComponentsNeedIssueSyncSql"/>
+ from dual
</select>
</mapper>
order by ncloc desc
</select>
- <select id="checkIfAnyOfComponentsWithQualifiers" resultType="short">
+ <sql id="checkIfAnyOfComponentsWithQualifiersSql">
select
case when exists
(
then 1
else 0
end
+ </sql>
+
+ <select id="checkIfAnyOfComponentsWithQualifiers" resultType="short">
+ <include refid="checkIfAnyOfComponentsWithQualifiersSql"/>
+ </select>
+
+ <select id="checkIfAnyOfComponentsWithQualifiers" resultType="short" databaseId="oracle">
+ <include refid="checkIfAnyOfComponentsWithQualifiersSql"/>
+ from dual
</select>
</mapper>
private void insertView(String view_uuid) {
ComponentDto view = new ComponentDto();
view.setQualifier("VW");
+ view.setDbKey(view_uuid + "_key");
view.setUuid(view_uuid);
view.setOrganizationUuid("org_uuid");
view.setPrivate(false);
private void insertBranch(String uuid) {
ComponentDto branch = new ComponentDto();
branch.setQualifier("TRK");
+ branch.setDbKey(uuid + "_key");
branch.setUuid(uuid);
branch.setOrganizationUuid("org_uuid");
branch.setPrivate(false);