]> source.dussan.org Git - sonarqube.git/commitdiff
Trying to fix filters on Oracle
authorDavid Gageot <david@gageot.net>
Wed, 23 May 2012 07:13:47 +0000 (09:13 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 23 May 2012 08:11:04 +0000 (10:11 +0200)
sonar-core/src/main/resources/org/sonar/core/filter/CriterionMapper-oracle.xml
sonar-core/src/main/resources/org/sonar/core/filter/FilterColumnMapper-oracle.xml
sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper-oracle.xml
sonar-core/src/main/resources/org/sonar/core/filter/FilterMapper.xml

index 5c9d27ac1008bd04f10b8287435a922202127d50..a3fdba730420da54adf5dec2986176411f70dcef 100644 (file)
@@ -4,9 +4,11 @@
 <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 (criteria_seq.NEXTVAL, #{filterId, jdbcType=INTEGER}, #{family, jdbcType=VARCHAR}, #{key, jdbcType=VARCHAR}, #{operator, jdbcType=VARCHAR}, #{value, jdbcType=FLOAT},
-     #{textValue, jdbcType=VARCHAR}, #{variation})
+    VALUES (#{id}, #{filterId, jdbcType=INTEGER}, #{family, jdbcType=VARCHAR}, #{key, jdbcType=VARCHAR}, #{operator, jdbcType=VARCHAR}, #{value, jdbcType=FLOAT}, #{textValue, jdbcType=VARCHAR}, #{variation})
   </insert>
 
 </mapper>
index e7705006f518fe413ddeed929628c979a3a5aa94..ee7e8982f9671969b7190385f47c0415babfd106 100644 (file)
@@ -3,9 +3,12 @@
 
 <mapper namespace="org.sonar.core.filter.FilterColumnMapper">
 
-  <insert id="insert" parameterType="FilterColumn" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <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 (filter_columns_seq.NEXTVAL, #{filterId, jdbcType=INTEGER}, #{family, jdbcType=VARCHAR}, #{key, jdbcType=VARCHAR}, #{sortDirection, jdbcType=VARCHAR},
+    VALUES ((#{id}, #{filterId, jdbcType=INTEGER}, #{family, jdbcType=VARCHAR}, #{key, jdbcType=VARCHAR}, #{sortDirection, jdbcType=VARCHAR},
      #{orderIndex, jdbcType=INTEGER}, #{variation})
   </insert>
 
index 854b0749ff8fbaacb6f57656575baf8653986293..76ab33d4f61b0d7ab6e7fd2765183c9f82cb3d54 100644 (file)
@@ -5,12 +5,12 @@
 
   <select id="findFilter" parameterType="string" resultType="Filter">
     select id, name, 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 name=#{id}
+    from filters WHERE name=#{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
+  <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, user_id, shared, favourites, resource_id, default_view, page_size, period_index)
     VALUES (#{id}, #{name, jdbcType=VARCHAR}, #{userId, jdbcType=FLOAT}, #{shared}, #{favourites}, #{resourceId, jdbcType=INTEGER}, #{defaultView, jdbcType=VARCHAR},
index bd5859e55f402f8d935b3123ca1778b59dd74306..7ef76f9904e2eacfa2eb80f733dbe3f1f82cc986 100644 (file)
@@ -5,7 +5,7 @@
 
   <select id="findFilter" parameterType="string" resultType="Filter">
     select id, name, 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 name=#{id}
+    from filters WHERE name=#{id} and user_id is null
   </select>
 
   <insert id="insert" parameterType="Filter" useGeneratedKeys="true" keyProperty="id">