All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.db.es.EsQueueMapper.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.sonar.db.es.EsQueueMapper">

  <sql id="esQueueColumns">
    uuid,
    doc_type as docType,
    doc_id as docId,
    doc_id_type as docIdType,
    doc_routing as docRouting,
    created_at as createdAt
  </sql>

  <insert id="insert" parameterType="map" useGeneratedKeys="false">
    insert into es_queue (
      uuid,
      doc_type,
      doc_id,
      doc_id_type,
      doc_routing,
      created_at
    ) values (
      #{dto.uuid, jdbcType=VARCHAR},
      #{dto.docType, jdbcType=VARCHAR},
      #{dto.docId, jdbcType=VARCHAR},
      #{dto.docIdType, jdbcType=VARCHAR},
      #{dto.docRouting, jdbcType=VARCHAR},
      #{now, jdbcType=BIGINT}
    )
  </insert>

  <delete id="delete" parameterType="string">
    delete from es_queue
    where uuid in
      <foreach item="uuid" collection="uuids" open="(" separator="," close=")">
        #{uuid, jdbcType=VARCHAR}
      </foreach>
  </delete>

  <select id="selectForRecovery" parameterType="map" resultType="org.sonar.db.es.EsQueueDto">
    select <include refid="esQueueColumns" />
    from es_queue
    where
    created_at &lt;= #{beforeDate, jdbcType=BIGINT}
    order by created_at desc
    limit #{limit, jdbcType=INTEGER}
  </select>

  <select id="selectForRecovery" parameterType="map" resultType="org.sonar.db.es.EsQueueDto" databaseId="oracle">
    select * from (
    select rownum as rn, t.* from (
      select <include refid="esQueueColumns" />
      from es_queue
      where
      created_at &lt;= #{beforeDate, jdbcType=BIGINT}
      order by created_at desc
    ) t
    ) t
    where
    t.rn &lt;= #{limit, jdbcType=INTEGER}
  </select>

  <select id="selectForRecovery" parameterType="map" resultType="org.sonar.db.es.EsQueueDto" databaseId="mssql">
    select top(#{limit, jdbcType=INTEGER}) <include refid="esQueueColumns" />
    from es_queue
    where
    created_at &lt;= #{beforeDate, jdbcType=BIGINT}
    order by created_at desc
  </select>

</mapper>





© 2015 - 2025 Weber Informatics LLC | Privacy Policy