]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3645 merge mapper xml files for oracle
authorDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 15:36:06 +0000 (17:36 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 11 Jul 2012 15:38:40 +0000 (17:38 +0200)
27 files changed:
sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml
sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml
sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml
sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml
sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper.xml
sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper.xml
sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml
sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml
sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml
sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/review/ReviewCommentMapper.xml
sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml
sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml
sonar-core/src/main/resources/org/sonar/core/user/RoleMapper-oracle.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml

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 (file)
index 4c6acb6..0000000
+++ /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>
index bdd5b01c8905e9547a4ee4a8430810000b5e48da..18085d74dade45b4dbfcd1298505bb0d8c473fe8 100644 (file)
@@ -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 (file)
index 6be6dba..0000000
+++ /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>
index 8fceb2402ac56b59554833e502a3f92b841de712..b7ab9140f9f5b13b71d17ff8b55230916b3b2497 100644 (file)
     #{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 (file)
index 28eb783..0000000
+++ /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>
index 4f60fdc364eb48ba25623f9d1cae9871f47d3711..ee2b13ed999297228c59c8f23530045e6cc43880 100644 (file)
@@ -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 (file)
index 2d149bb..0000000
+++ /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>
index 73b9156029dbba5bc30c442f3d3144c2628a3b89..ed3cb3e960c8b7c25b94f2dfd14ffa7321a6f82a 100644 (file)
@@ -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 (file)
index 1196f6d..0000000
+++ /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>
index e90aa3377743ff4f1ff0edb55b41b321f364a292..028fa978ad9c491e81334bbf902ff25aca452749 100644 (file)
@@ -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 (file)
index 37fb49c..0000000
+++ /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>
index c1d01509dda7a352cc09f38fef5f5588c9af7569..6f55eee3a1e1b8f534e762ac94fdab914a2a8058 100644 (file)
@@ -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 (file)
index 9235b43..0000000
+++ /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>
index 782a76c67c47650986c33ba2fb3292f53bafd335..620db8c1f3f6a7fe32a2a344eb4ba0f0e10ec6b9 100644 (file)
      #{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 (file)
index 3f7d6ad..0000000
+++ /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 (file)
index f128b55..0000000
+++ /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>
-
index 33cb98db05976b1f972925fbf11b895a448ca524..3881c6050fe9e5cf52b8c6d4298d24ed3cc378fc 100644 (file)
     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 (file)
index 4f8ff7a..0000000
+++ /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>
-
index 2f4fc2735e27cf3bc5ecbc29968f0f1912e9851e..5a89472deac2bfe311662617365a9a0f309bcf91 100644 (file)
     )
   </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 (file)
index d6bf54d..0000000
+++ /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>
index 3fc4f19c9a4cf8b9419bf43a0d75d6b2bfedeb7e..a99dca4ffa3a9718ba2115ce523abd4afebf3614 100644 (file)
@@ -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 (file)
index 61b5d50..0000000
+++ /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>
index 67342449f4adba8f1cb548ec647f749c9528874c..5b6862e541b1c8605ba48558de5569f1f8949b87 100644 (file)
     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 (file)
index e0b191c..0000000
+++ /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>
index 96e1959845f6b759c518b73918409bae786b8f78..684bdd2efada6ab1f4ce30329993a2fa01174f07 100644 (file)
     #{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 (file)
index 996fc4f..0000000
+++ /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>
index d553b81ae460bcd0721ce559505fed5792af1975..720a7690d4e9b73feeb83b209bfac6115c1fa72b 100644 (file)
@@ -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>