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

org.sonar.db.source.FileSourceMapper.xml Maven / Gradle / Ivy

There is a newer version: 6.3.1
Show 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.source.FileSourceMapper">

  <select id="select" parameterType="map" resultType="org.sonar.db.source.FileSourceDto">
    SELECT id, project_uuid as projectUuid, file_uuid as fileUuid, created_at as createdAt, updated_at as updatedAt,
    binary_data as binaryData, line_hashes as lineHashes, data_hash as dataHash, src_hash as srcHash, data_type as
    dataType, revision
    FROM file_sources
    WHERE file_uuid = #{fileUuid} and data_type = #{dataType}
  </select>

  <select id="selectHashesForProject" parameterType="map" resultType="org.sonar.db.source.FileSourceDto">
    SELECT id, file_uuid as fileUuid, data_hash as dataHash, src_hash as srcHash, revision, updated_at as updatedAt
    FROM file_sources
    WHERE project_uuid = #{projectUuid} and data_type=#{dataType}
  </select>

  <insert id="insert" parameterType="org.sonar.db.source.FileSourceDto" useGeneratedKeys="false">
    INSERT INTO file_sources (project_uuid, file_uuid, created_at, updated_at, binary_data, line_hashes, data_hash,
    src_hash, data_type, revision)
    VALUES (#{projectUuid,jdbcType=VARCHAR}, #{fileUuid,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT},
    #{updatedAt,jdbcType=BIGINT}, #{binaryData,jdbcType=BLOB}, #{lineHashes,jdbcType=CLOB},
    #{dataHash,jdbcType=VARCHAR}, #{srcHash,jdbcType=VARCHAR},#{dataType,jdbcType=VARCHAR},
    #{revision,jdbcType=VARCHAR})
  </insert>

  <update id="update" parameterType="org.sonar.db.source.FileSourceDto" useGeneratedKeys="false">
    UPDATE file_sources SET
    updated_at = #{updatedAt,jdbcType=BIGINT},
    binary_data = #{binaryData,jdbcType=BLOB},
    line_hashes = #{lineHashes,jdbcType=CLOB},
    data_hash = #{dataHash,jdbcType=VARCHAR},
    src_hash = #{srcHash,jdbcType=VARCHAR},
    revision = #{revision,jdbcType=VARCHAR}
    WHERE id = #{id}
  </update>

  <update id="updateDateWhenUpdatedDateIsZero" parameterType="org.sonar.db.source.FileSourceDto"
          useGeneratedKeys="false">
    UPDATE file_sources SET
    updated_at = #{date,jdbcType=BIGINT}
    WHERE project_uuid = #{projectUuid}
    AND updated_at = 0
  </update>
</mapper>





© 2015 - 2025 Weber Informatics LLC | Privacy Policy