</sql>
<sql id="orderByDateAndId">
- order by cq.created_at asc, cq.id asc
+ order by
+ cq.created_at asc,
+ cq.id asc
</sql>
<sql id="orderByDescDateAndId">
- order by cq.created_at desc, cq.id desc
+ order by
+ cq.created_at desc,
+ cq.id desc
</sql>
<select id="selectByUuid" parameterType="String" resultType="org.sonar.db.ce.CeQueueDto">
select
- <include refid="columns"/>
- from ce_queue cq
- where cq.uuid=#{uuid,jdbcType=VARCHAR}
+ <include refid="columns"/>
+ from
+ ce_queue cq
+ where
+ cq.uuid=#{uuid,jdbcType=VARCHAR}
</select>
<select id="countByStatusAndComponentUuid" parameterType="map" resultType="int">
- select count(1)
- from ce_queue
- where status=#{status,jdbcType=VARCHAR}
- <if test="componentUuid!=null">
- and component_uuid=#{componentUuid,jdbcType=VARCHAR}
- </if>
+ select
+ count(1)
+ from
+ ce_queue
+ where
+ status=#{status,jdbcType=VARCHAR}
+ <if test="componentUuid!=null">
+ and component_uuid=#{componentUuid,jdbcType=VARCHAR}
+ </if>
</select>
<select id="countAll" resultType="int">
- select count(1) from ce_queue
+ select
+ count(1)
+ from
+ ce_queue
</select>
<select id="selectByComponentUuid" parameterType="String" resultType="org.sonar.db.ce.CeQueueDto">
select
- <include refid="columns"/>
- from ce_queue cq
- where cq.component_uuid=#{componentUuid,jdbcType=VARCHAR}
+ <include refid="columns"/>
+ from
+ ce_queue cq
+ where
+ cq.component_uuid=#{componentUuid,jdbcType=VARCHAR}
<include refid="orderByDateAndId"/>
</select>
<select id="selectAllInAscOrder" resultType="org.sonar.db.ce.CeQueueDto">
select
- <include refid="columns"/>
- from ce_queue cq
+ <include refid="columns"/>
+ from
+ ce_queue cq
<include refid="orderByDateAndId"/>
</select>
</select>
<select id="countByQuery" resultType="int">
- select count(1)
+ select
+ count(1)
<include refid="sqlSelectByQuery"/>
</select>
<sql id="sqlSelectByQuery">
- from ce_queue cq
+ from
+ ce_queue cq
<where>
<if test="query.componentUuids != null and query.componentUuids.size()>0">
and cq.component_uuid in
</sql>
<select id="selectEligibleForPeek" resultType="String">
- select cq.uuid
- from ce_queue cq
- where cq.status='PENDING'
- and not exists(
- select 1
- from ce_queue cq2
- where cq.component_uuid=cq2.component_uuid and cq2.status <> 'PENDING'
- )
+ select
+ cq.uuid
+ from
+ ce_queue cq
+ where
+ cq.status='PENDING'
+ and not exists (
+ select
+ 1
+ from
+ ce_queue cq2
+ where
+ cq.component_uuid=cq2.component_uuid
+ and cq2.status <> 'PENDING'
+ )
<include refid="orderByDateAndId"/>
</select>
<insert id="insert" parameterType="org.sonar.db.ce.CeQueueDto" useGeneratedKeys="false">
insert into ce_queue
- (uuid, task_type, component_uuid, status, submitter_login, started_at, created_at, updated_at)
+ (
+ uuid,
+ task_type,
+ component_uuid,
+ status,
+ submitter_login,
+ started_at,
+ created_at,
+ updated_at
+ )
values (
- #{uuid,jdbcType=VARCHAR},
- #{taskType,jdbcType=VARCHAR},
- #{componentUuid,jdbcType=VARCHAR},
- #{status,jdbcType=VARCHAR},
- #{submitterLogin,jdbcType=VARCHAR},
- #{startedAt,jdbcType=BIGINT},
- #{createdAt,jdbcType=BIGINT},
- #{updatedAt,jdbcType=BIGINT}
+ #{uuid,jdbcType=VARCHAR},
+ #{taskType,jdbcType=VARCHAR},
+ #{componentUuid,jdbcType=VARCHAR},
+ #{status,jdbcType=VARCHAR},
+ #{submitterLogin,jdbcType=VARCHAR},
+ #{startedAt,jdbcType=BIGINT},
+ #{createdAt,jdbcType=BIGINT},
+ #{updatedAt,jdbcType=BIGINT}
)
</insert>
<update id="resetAllToPendingStatus" parameterType="map">
- update ce_queue
- set status='PENDING', started_at=NULL, updated_at=#{updatedAt,jdbcType=BIGINT}
- where status <> 'PENDING'
+ update ce_queue set
+ status='PENDING',
+ started_at=NULL,
+ updated_at=#{updatedAt,jdbcType=BIGINT}
+ where
+ status <> 'PENDING'
</update>
<update id="updateIfStatus" parameterType="map">
- update ce_queue
- set status=#{newStatus,jdbcType=VARCHAR},
- started_at=#{startedAt,jdbcType=BIGINT},
- updated_at=#{updatedAt,jdbcType=BIGINT}
- where uuid=#{uuid,jdbcType=VARCHAR} and status=#{oldStatus,jdbcType=VARCHAR}
+ update ce_queue set
+ status=#{newStatus,jdbcType=VARCHAR},
+ started_at=#{startedAt,jdbcType=BIGINT},
+ updated_at=#{updatedAt,jdbcType=BIGINT}
+ where
+ uuid=#{uuid,jdbcType=VARCHAR}
+ and status=#{oldStatus,jdbcType=VARCHAR}
</update>
<delete id="deleteByUuid">
- delete from ce_queue where uuid=#{uuid,jdbcType=VARCHAR}
+ delete from
+ ce_queue
+ where
+ uuid=#{uuid,jdbcType=VARCHAR}
</delete>
</mapper>