+++ /dev/null
-<?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.core.dashboard.ActiveDashboardMapper">
-
- <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
- select active_dashboards_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO active_dashboards (id, dashboard_id, user_id, order_index)
- VALUES (#{id}, #{dashboardId}, #{userId}, #{orderIndex})
- </insert>
-
- <select id="selectMaxOrderIndexForNullUser" resultType="Integer">
- SELECT MAX(order_index)
- FROM active_dashboards
- WHERE user_id IS NULL
- </select>
-
-</mapper>
VALUES (#{dashboardId}, #{userId}, #{orderIndex})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
+ select active_dashboards_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO active_dashboards (id, dashboard_id, user_id, order_index)
+ VALUES (#{id}, #{dashboardId}, #{userId}, #{orderIndex})
+ </insert>
+
<select id="selectMaxOrderIndexForNullUser" resultType="Integer">
SELECT MAX(order_index)
FROM active_dashboards
+++ /dev/null
-<?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.core.dashboard.DashboardMapper">
-
- <select id="selectGlobalDashboard" parameterType="string" resultType="Dashboard">
- select id, user_id as "userId", name, description, column_layout as "columnLayout", shared, is_global, created_at as "createdAt", updated_at as "updatedAt"
- from dashboards WHERE name=#{id} and user_id is null
- </select>
-
- <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select dashboards_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO dashboards (id, user_id, name, description, column_layout, shared, is_global, created_at, updated_at)
- VALUES (#{id}, #{userId}, #{name}, #{description},
- #{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt})
- </insert>
-
-</mapper>
#{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select dashboards_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO dashboards (id, user_id, name, description, column_layout, shared, is_global, created_at, updated_at)
+ VALUES (#{id}, #{userId}, #{name}, #{description},
+ #{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.dashboard.WidgetMapper">
-
- <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
- select widgets_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO widgets (id, dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id)
- VALUES (#{id}, #{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex},
- #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId})
- </insert>
-
-</mapper>
#{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
+ select widgets_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO widgets (id, dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id)
+ VALUES (#{id}, #{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex},
+ #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.dashboard.WidgetPropertyMapper">
-
- <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="false" keyProperty="id">
- INSERT INTO widget_properties (id, widget_id, kee, text_value)
- VALUES (widget_properties_seq.NEXTVAL, #{widgetId}, #{key}, #{value})
- </insert>
-
-</mapper>
VALUES (#{widgetId}, #{key}, #{value})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="false" keyProperty="id">
+ INSERT INTO widget_properties (id, widget_id, kee, text_value)
+ VALUES (widget_properties_seq.NEXTVAL, #{widgetId}, #{key}, #{value})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.filter.CriterionMapper">
-
- <insert id="insert" parameterType="Criterion" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select criteria_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO criteria (id, filter_id, family, kee, operator, value, text_value, variation)
- VALUES (#{id}, #{filterId}, #{family}, #{key}, #{operator}, #{value}, #{textValue}, #{variation})
- </insert>
-
-</mapper>
#{textValue}, #{variation})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Criterion" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select criteria_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO criteria (id, filter_id, family, kee, operator, value, text_value, variation)
+ VALUES (#{id}, #{filterId}, #{family}, #{key}, #{operator}, #{value}, #{textValue}, #{variation})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.filter.FilterColumnMapper">
-
- <insert id="insert" parameterType="FilterColumn" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
- select filter_columns_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO filter_columns (id, filter_id, family, kee, sort_direction, order_index, variation)
- VALUES (#{id}, #{filterId}, #{family}, #{key}, #{sortDirection},
- #{orderIndex}, #{variation})
- </insert>
-
-</mapper>
#{orderIndex}, #{variation})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="FilterColumn" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
+ select filter_columns_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO filter_columns (id, filter_id, family, kee, sort_direction, order_index, variation)
+ VALUES (#{id}, #{filterId}, #{family}, #{key}, #{sortDirection},
+ #{orderIndex}, #{variation})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.filter.FilterMapper">
-
- <select id="findFilter" parameterType="string" resultType="Filter">
- select id, name, kee as "key", user_id as "userId", shared, favourites, resource_id as "resourceId", default_view as "defaultView", page_size as "pageSize", period_index as "periodIndex"
- from filters WHERE kee=#{id} and user_id is null
- </select>
-
- <insert id="insert" parameterType="Filter" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
- select filters_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO filters (id, name, kee, user_id, shared, favourites, resource_id, default_view, page_size, period_index)
- VALUES (#{id}, #{name}, #{key}, #{userId}, #{shared}, #{favourites}, #{resourceId}, #{defaultView},
- #{pageSize}, #{periodIndex})
- </insert>
-
-</mapper>
#{pageSize}, #{periodIndex})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Filter" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
+ select filters_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO filters (id, name, kee, user_id, shared, favourites, resource_id, default_view, page_size, period_index)
+ VALUES (#{id}, #{name}, #{key}, #{userId}, #{shared}, #{favourites}, #{resourceId}, #{defaultView},
+ #{pageSize}, #{periodIndex})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.properties.PropertiesMapper">
-
- <select id="findUserIdsForFavouriteResource" parameterType="map" resultType="String">
- SELECT U.login
- FROM properties P, users U
- WHERE P.prop_key = 'favourite' AND P.resource_id = #{id} AND P.user_id = U.id
- </select>
-
- <select id="selectGlobalProperties" resultType="Property">
- select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
- from properties p
- where p.resource_id is null and p.user_id is null
- </select>
-
- <select id="selectProjectProperties" parameterType="String" resultType="Property">
- select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
- from properties p, projects r
- where p.resource_id=r.id and p.user_id is null and r.kee=#{id}
- </select>
-
- <select id="selectSetOfResourceProperties" parameterType="map" resultType="Property">
- select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
- from properties p
- where p.resource_id=#{rId} and p.prop_key in
- <foreach item="propKey" index="index" collection="propKeys" open="(" separator="," close=")">#{propKey}</foreach>
- </select>
-
- <select id="selectByKey" parameterType="map" resultType="Property">
- select p.id as id, p.prop_key as "key", p.text_value as value, p.resource_id as resourceId, p.user_id as userId
- from properties p
- where p.prop_key=#{key}
- <if test="resourceId == null">
- AND p.resource_id is null
- </if>
- <if test="resourceId != null">
- AND p.resource_id=#{resourceId}
- </if>
- <if test="userId == null">
- AND p.user_id is null
- </if>
- <if test="userId != null">
- AND p.user_id=#{userId}
- </if>
- </select>
-
- <update id="update" parameterType="Property">
- update properties set text_value = #{value} where id = #{id}
- </update>
-
- <insert id="insert" parameterType="Property" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select properties_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO properties (id, prop_key, resource_id, user_id, text_value)
- VALUES (#{id}, #{key}, #{resourceId}, #{userId}, #{value})
- </insert>
-
-</mapper>
+++ /dev/null
-<?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.core.resource.ResourceIndexerMapper">
-
- <!--
- The column PROJECTS.ROOT_ID is not exact on multi-modules projects. The root id must
- be loaded from the table SNAPSHOTS
- -->
- <select id="selectResources" parameterType="map" resultType="Resource">
- select p.name as "name", p.id as "id", p.scope as "scope", p.qualifier as "qualifier", s.root_project_id as "rootId"
- from projects p, snapshots s
- <where>
- p.enabled=${_true}
- and p.copy_resource_id is null
- and p.id=s.project_id
- and s.islast=${_true}
- <if test="scopes != null">
- and p.scope in
- <foreach item="scope" index="index" collection="scopes" open="(" separator="," close=")">#{scope}</foreach>
- </if>
- <if test="qualifiers != null">
- and p.qualifier in
- <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")">#{qualifier}
- </foreach>
- </if>
- <if test="rootProjectId != null">
- and s.root_project_id=#{rootProjectId}
- </if>
- <if test="nonIndexedOnly">
- and not exists(select * from resource_index ri where ri.resource_id=p.id)
- </if>
- </where>
- </select>
-
- <select id="selectRootProjectIds" parameterType="map" resultType="int">
- select distinct root_project_id
- from snapshots
- where islast=${_true}
- and scope='PRJ'
- and qualifier in ('TRK', 'VW', 'SVW')
- </select>
-
- <select id="selectMasterIndexByResourceId" parameterType="long" resultType="ResourceIndex">
- select kee as "key", resource_id as "resourceId"
- from resource_index
- where resource_id=#{id} and position=0
- </select>
-
- <select id="selectResourceToIndex" parameterType="long" resultType="Resource">
- select id, name, root_id as "rootId", qualifier
- from projects
- where id=#{id} and enabled=${_true}
- </select>
-
- <delete id="deleteByResourceId" parameterType="long">
- delete from resource_index
- where resource_id=#{id}
- </delete>
-
- <insert id="insert" parameterType="ResourceIndex" useGeneratedKeys="false">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select resource_index_seq.NEXTVAL from DUAL
- </selectKey>
- insert into resource_index (id, kee, position, name_size, resource_id, root_project_id, qualifier)
- values (#{id}, #{key}, #{position}, #{nameSize},
- #{resourceId}, #{rootProjectId}, #{qualifier})
- </insert>
-</mapper>
-
values (#{key}, #{position}, #{nameSize},
#{resourceId}, #{rootProjectId}, #{qualifier})
</insert>
+
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="ResourceIndex" useGeneratedKeys="false">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select resource_index_seq.NEXTVAL from DUAL
+ </selectKey>
+ insert into resource_index (id, kee, position, name_size, resource_id, root_project_id, qualifier)
+ values (#{id}, #{key}, #{position}, #{nameSize},
+ #{resourceId}, #{rootProjectId}, #{qualifier})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.resource.ResourceMapper">
-
- <resultMap id="snapshotResultMap" type="Snapshot">
- <id property="id" column="id"/>
- <result property="parentId" column="parent_snapshot_id"/>
- <result property="rootId" column="root_snapshot_id"/>
- <result property="date" column="created_at"/>
- <result property="buildDate" column="build_date"/>
- <result property="resourceId" column="project_id"/>
- <result property="status" column="status"/>
- <result property="purgeStatus" column="purge_status"/>
- <result property="last" column="islast"/>
- <result property="scope" column="scope"/>
- <result property="qualifier" column="qualifier"/>
- <result property="version" column="version"/>
- <result property="path" column="path"/>
- <result property="depth" column="depth"/>
- <result property="rootProjectId" column="root_project_id"/>
- </resultMap>
-
- <resultMap id="resourceResultMap" type="Resource">
- <id property="id" column="id"/>
- <result property="key" column="kee"/>
- <result property="name" column="name"/>
- <result property="longName" column="long_name"/>
- <result property="rootId" column="root_id"/>
- <result property="scope" column="scope"/>
- <result property="qualifier" column="qualifier"/>
- <result property="enabled" column="enabled"/>
- <result property="description" column="description"/>
- <result property="language" column="language"/>
- <result property="copyResourceId" column="copy_resource_id"/>
- <result property="personId" column="person_id"/>
- <result property="profileId" column="profile_id"/>
- </resultMap>
-
- <select id="selectResources" parameterType="map" resultMap="resourceResultMap">
- select *
- from projects p
- <where>
- <if test="qualifiers != null and qualifiers.length!=0">
- and p.qualifier in
- <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")">#{qualifier}</foreach>
- </if>
- <if test="key != null">
- and p.kee=#{key}
- </if>
- <if test="excludeDisabled">
- and p.enabled=${_true}
- </if>
- </where>
- </select>
-
- <select id="selectResourceIds" parameterType="map" resultType="long">
- select p.id
- from projects p
- <where>
- <if test="qualifiers != null and qualifiers.length!=0">
- and p.qualifier in
- <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")">#{qualifier}</foreach>
- </if>
- <if test="key != null">
- and p.kee=#{key}
- </if>
- <if test="excludeDisabled">
- and p.enabled=${_true}
- </if>
- </where>
- </select>
-
- <select id="selectResource" parameterType="long" resultMap="resourceResultMap">
- select * from projects where id=#{id}
- </select>
-
- <select id="selectSnapshot" parameterType="long" resultMap="snapshotResultMap">
- select * from snapshots where id=#{id}
- </select>
-
- <select id="selectDescendantProjects" parameterType="long" resultMap="resourceResultMap">
- select * from projects where scope='PRJ' and root_id=#{id}
- </select>
-
- <insert id="insert" parameterType="Resource" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select projects_seq.NEXTVAL from DUAL
- </selectKey>
- insert into projects
- (id, name, long_name, description, scope, qualifier, kee, language, root_id, copy_resource_id, person_id, profile_id, enabled)
- values (
- #{id}, #{name}, #{longName}, #{description}, #{scope}, #{qualifier},
- #{key}, #{language}, #{rootId}, #{copyResourceId},
- #{personId}, #{profileId}, #{enabled}
- )
- </insert>
-
- <update id="update" parameterType="Resource">
- update projects set name=#{name}, long_name=#{longName}, description=#{description},
- scope=#{scope}, qualifier=#{qualifier}, kee=#{key},
- language=#{language}, root_id=#{rootId}, copy_resource_id=#{copyResourceId},
- person_id=#{personId}, profile_id=#{profileId}, enabled=#{enabled} where id=#{id}
- </update>
-</mapper>
-
)
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Resource" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select projects_seq.NEXTVAL from DUAL
+ </selectKey>
+ insert into projects
+ (id, name, long_name, description, scope, qualifier, kee, language, root_id, copy_resource_id, person_id, profile_id, enabled)
+ values (
+ #{id}, #{name}, #{longName}, #{description}, #{scope}, #{qualifier},
+ #{key}, #{language}, #{rootId}, #{copyResourceId},
+ #{personId}, #{profileId}, #{enabled}
+ )
+ </insert>
+
<update id="update" parameterType="Resource">
update projects set name=#{name}, long_name=#{longName}, description=#{description},
scope=#{scope}, qualifier=#{qualifier}, kee=#{key},
+++ /dev/null
-<?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.core.review.ReviewCommentMapper">
-
- <insert id="insert" parameterType="ReviewComment" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
- select review_comments_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO review_comments (id, review_id, user_id, review_text, created_at, updated_at)
- VALUES (#{id}, #{reviewId}, #{userId}, #{text},
- #{createdAt}, #{updatedAt})
- </insert>
-
-</mapper>
#{createdAt}, #{updatedAt})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="ReviewComment" keyColumn="id" useGeneratedKeys="true" keyProperty ="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id" >
+ select review_comments_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO review_comments (id, review_id, user_id, review_text, created_at, updated_at)
+ VALUES (#{id}, #{reviewId}, #{userId}, #{text},
+ #{createdAt}, #{updatedAt})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.template.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">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select loaded_templates_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO loaded_templates (id, kee, template_type)
- VALUES (#{id}, #{key}, #{type})
- </insert>
-
-</mapper>
VALUES (#{key}, #{type})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select loaded_templates_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO loaded_templates (id, kee, template_type)
+ VALUES (#{id}, #{key}, #{type})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.user.AuthorMapper">
-
- <select id="selectByLogin" parameterType="string" resultType="Author">
- SELECT id, person_id AS "personId", login, created_at AS "createdAt", updated_at AS "updatedAt"
- FROM authors WHERE login=#{id}
- </select>
-
- <select id="countDeveloperLogins" parameterType="long" resultType="int">
- SELECT count(id)
- FROM authors WHERE person_id=#{id}
- </select>
-
- <insert id="insert" parameterType="Author" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select authors_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO authors (id, person_id, login, created_at, updated_at)
- VALUES (#{id}, #{personId}, #{login},
- #{createdAt}, #{updatedAt})
- </insert>
-
-</mapper>
#{createdAt}, #{updatedAt})
</insert>
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="Author" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select authors_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO authors (id, person_id, login, created_at, updated_at)
+ VALUES (#{id}, #{personId}, #{login},
+ #{createdAt}, #{updatedAt})
+ </insert>
+
</mapper>
+++ /dev/null
-<?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.core.user.RoleMapper">
-
- <insert id="insertGroupRole" parameterType="GroupRole" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select group_roles_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO group_roles (id, group_id, resource_id, role)
- VALUES (#{id}, #{groupId}, #{resourceId}, #{role})
- </insert>
-
- <insert id="insertUserRole" parameterType="UserRole" useGeneratedKeys="true" keyProperty="id">
- <selectKey order="BEFORE" resultType="Long" keyProperty="id">
- select user_roles_seq.NEXTVAL from DUAL
- </selectKey>
- INSERT INTO user_roles (id, user_id, resource_id, role)
- VALUES (#{id}, #{userId}, #{resourceId}, #{role})
- </insert>
-
- <delete id="deleteGroupRolesByResourceId" parameterType="long">
- delete from group_roles where resource_id=#{id}
- </delete>
-
- <delete id="deleteUserRolesByResourceId" parameterType="long">
- delete from user_roles where resource_id=#{id}
- </delete>
-
- <select id="countUserRoles" parameterType="long" resultType="int">
- SELECT count(id)
- FROM user_roles WHERE resource_id=#{id}
- </select>
-
- <select id="countGroupRoles" parameterType="long" resultType="int">
- SELECT count(id)
- FROM group_roles WHERE resource_id=#{id}
- </select>
-</mapper>
VALUES (#{groupId}, #{resourceId}, #{role})
</insert>
+ <!-- Oracle -->
+ <insert id="insertGroupRole" databaseId="oracle" parameterType="GroupRole" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select group_roles_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO group_roles (id, group_id, resource_id, role)
+ VALUES (#{id}, #{groupId}, #{resourceId}, #{role})
+ </insert>
+
<insert id="insertUserRole" parameterType="UserRole" useGeneratedKeys="true" keyProperty="id">
INSERT INTO user_roles (user_id, resource_id, role)
VALUES (#{userId}, #{resourceId}, #{role})
</insert>
+ <!-- Oracle -->
+ <insert id="insertUserRole" databaseId="oracle" parameterType="UserRole" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select user_roles_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO user_roles (id, user_id, resource_id, role)
+ VALUES (#{id}, #{userId}, #{resourceId}, #{role})
+ </insert>
+
<delete id="deleteGroupRolesByResourceId" parameterType="long">
delete from group_roles where resource_id=#{id}
</delete>