aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/main/resources/org/sonar/db/loadedtemplate
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-04 00:34:24 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-04 17:00:08 +0200
commit1df148803610cd54f182b8636f01c0e6ece92b19 (patch)
tree8b6d2919ebe3575556b8796fd95a2b89996933ff /sonar-db/src/main/resources/org/sonar/db/loadedtemplate
parent1018747567d50056a49aa7c8421d596f18f25344 (diff)
downloadsonarqube-1df148803610cd54f182b8636f01c0e6ece92b19.tar.gz
sonarqube-1df148803610cd54f182b8636f01c0e6ece92b19.zip
Extract module sonar-db
Diffstat (limited to 'sonar-db/src/main/resources/org/sonar/db/loadedtemplate')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml26
1 files changed, 26 insertions, 0 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml b/sonar-db/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml
new file mode 100644
index 00000000000..0395aad517a
--- /dev/null
+++ b/sonar-db/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml
@@ -0,0 +1,26 @@
+<?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.loadedtemplate.LoadedTemplateMapper">
+
+ <resultMap id="loadedTemplateResultMap" type="LoadedTemplate">
+ <result property="id" column="id"/>
+ <result property="key" column="kee"/>
+ <result property="type" column="template_type"/>
+ </resultMap>
+
+ <select id="countByTypeAndKey" parameterType="map" resultType="int">
+ SELECT count(*)
+ FROM loaded_templates
+ WHERE kee = #{key} AND template_type = #{type}
+ </select>
+
+ <insert id="insert" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ INSERT INTO loaded_templates (kee, template_type)
+ VALUES (#{key}, #{type})
+ </insert>
+
+ <delete id="delete" parameterType="map">
+ delete from loaded_templates where kee = #{key} AND template_type = #{type}
+ </delete>
+</mapper>