diff options
Diffstat (limited to 'sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml')
-rw-r--r-- | sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml new file mode 100644 index 00000000000..c6db203313b --- /dev/null +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml @@ -0,0 +1,39 @@ +<?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.component.ComponentLinkMapper"> + + <sql id="componentLinkColumns"> + p.id, + p.component_uuid as "componentUuid", + p.link_type as "type", + p.name as name, + p.href as href + </sql> + + <select id="selectByComponentUuid" parameterType="String" resultType="ComponentLink"> + SELECT + <include refid="componentLinkColumns"/> + FROM project_links p + <where> + AND p.component_uuid=#{uuid} + </where> + </select> + + <insert id="insert" parameterType="ComponentLink" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> + INSERT INTO project_links (component_uuid, link_type, name, href) + VALUES (#{componentUuid,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, + #{href,jdbcType=VARCHAR}) + </insert> + + <insert id="update" parameterType="ComponentLink" useGeneratedKeys="false"> + UPDATE project_links SET component_uuid=#{componentUuid,jdbcType=VARCHAR}, link_type=#{type,jdbcType=VARCHAR}, + name=#{name,jdbcType=VARCHAR}, href=#{href,jdbcType=VARCHAR} + WHERE id=#{id} + </insert> + + <delete id="delete"> + DELETE FROM project_links WHERE id=#{id} + </delete> + +</mapper> + |