diff options
author | David Gageot <david@gageot.net> | 2012-07-11 17:36:06 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-11 17:38:40 +0200 |
commit | de901ced10098dd12db964d5a280e2cb5421a9bf (patch) | |
tree | 8b15bee0c292e9ce8480555154701fc5143c59ed /sonar-core | |
parent | 5c0b5197da16f77786ea0d671e1ff1ea4e3b3518 (diff) | |
download | sonarqube-de901ced10098dd12db964d5a280e2cb5421a9bf.tar.gz sonarqube-de901ced10098dd12db964d5a280e2cb5421a9bf.zip |
SONAR-3645 merge mapper xml files for oracle
Diffstat (limited to 'sonar-core')
27 files changed, 136 insertions, 457 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper-oracle.xml deleted file mode 100644 index 4c6acb65218..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper-oracle.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml index bdd5b01c890..18085d74dad 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml @@ -8,6 +8,15 @@ 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 diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper-oracle.xml deleted file mode 100644 index 6be6dbaa326..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper-oracle.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml index 8fceb2402ac..b7ab9140f9f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml @@ -14,4 +14,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper-oracle.xml deleted file mode 100644 index 28eb783b122..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper-oracle.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml index 4f60fdc364e..ee2b13ed999 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml @@ -9,4 +9,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper-oracle.xml deleted file mode 100644 index 2d149bbff85..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper-oracle.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml index 73b9156029d..ed3cb3e960c 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml @@ -8,4 +8,10 @@ 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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper-oracle.xml deleted file mode 100644 index 1196f6d0fac..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper-oracle.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper.xml b/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper.xml index e90aa337774..028fa978ad9 100644 --- a/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper.xml @@ -9,4 +9,13 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper-oracle.xml deleted file mode 100644 index 37fb49c777d..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper-oracle.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper.xml b/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper.xml index c1d01509dda..6f55eee3a1e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper.xml @@ -9,4 +9,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper-oracle.xml deleted file mode 100644 index 9235b437a7f..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper-oracle.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml index 782a76c67c4..620db8c1f3f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml @@ -14,4 +14,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml deleted file mode 100644 index 3f7d6add7b0..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper-oracle.xml deleted file mode 100644 index f128b550999..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper-oracle.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?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> - diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml index 33cb98db059..3881c6050fe 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml @@ -63,5 +63,16 @@ 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> diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper-oracle.xml deleted file mode 100644 index 4f8ff7a8d1a..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper-oracle.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?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> - diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml index 2f4fc2735e2..5a89472deac 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml @@ -93,6 +93,20 @@ ) </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}, diff --git a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper-oracle.xml deleted file mode 100644 index d6bf54dfe63..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper-oracle.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml b/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml index 3fc4f19c9a4..a99dca4ffa3 100644 --- a/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml @@ -9,4 +9,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper-oracle.xml deleted file mode 100644 index 61b5d507111..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper-oracle.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml index 67342449f4a..5b6862e541b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml @@ -20,4 +20,13 @@ 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> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper-oracle.xml deleted file mode 100644 index e0b191c4a88..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper-oracle.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml index 96e1959845f..684bdd2efad 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml @@ -19,4 +19,14 @@ #{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> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper-oracle.xml deleted file mode 100644 index 996fc4fb4d5..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper-oracle.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?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> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml index d553b81ae46..720a7690d4e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml @@ -8,11 +8,29 @@ 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> |