]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4535 Fix SQL issue on Oracle when using properties.text_value
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Dec 2013 09:50:12 +0000 (10:50 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Dec 2013 09:50:12 +0000 (10:50 +0100)
sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml
sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml

index ac1598e4edbb77072ae419e51c23d0584b57c660..d130202688ac48ef9974747db8de9d3ad370cbd1 100644 (file)
   </delete>
 
   <delete id="deleteProjectProperties" parameterType="map">
-    delete from properties where prop_key=#{key} and text_value=#{value} and resource_id is not null and user_id is null
+    DELETE FROM properties
+    <where>
+      AND prop_key=#{key}
+      AND text_value LIKE #{value}
+      AND resource_id IS NOT NULL
+      AND user_id IS NULL
+    </where>
   </delete>
 
   <delete id="deleteGlobalProperty" parameterType="string">
index 35d70cfe04e10106439d436b6740a3a67ad2effa..b4b78d81fa1e27fd51d09ebf8e98052263707932 100644 (file)
   <select id="selectDefaultProfile" parameterType="Integer" resultType="QualityProfile">
     SELECT <include refid="profilesColumns"/>
     FROM rules_profiles p
-    INNER JOIN properties prop ON prop.text_value = p.name
+    INNER JOIN properties prop ON prop.prop_key=#{key}
+      AND prop.resource_id IS NULL
+      AND prop.text_value LIKE p.name
     <where>
       AND p.language=#{language}
-      AND prop.prop_key=#{key}
-      AND prop.resource_id IS NULL
     </where>
   </select>
 
     <where>
       AND properties.resource_id IS NOT NULL
       AND properties.prop_key=#{key}
-      AND properties.text_value like #{value}
+      AND properties.text_value LIKE #{value}
     </where>
   </select>
 
   <select id="selectByProject" parameterType="map" resultType="QualityProfile">
     SELECT DISTINCT <include refid="profilesColumns"/>
     FROM rules_profiles p
-    INNER JOIN properties prop ON prop.text_value = p.name
-    <where>
-      AND prop.resource_id=#{projectId}
-      AND prop.prop_key like #{key}
-    </where>
+    INNER JOIN properties prop ON prop.resource_id=#{projectId}
+      AND prop.prop_key LIKE #{key}
+      AND prop.text_value LIKE p.name
   </select>
 
   <insert id="insert" parameterType="QualityProfile" keyColumn="id" useGeneratedKeys="true" keyProperty="id">