]> source.dussan.org Git - sonarqube.git/commitdiff
Refactor the SQL request to select notif properties
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 10 Jun 2015 11:41:25 +0000 (13:41 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 10 Jun 2015 11:41:25 +0000 (13:41 +0200)
It should restore the compatibility with all supported dbs.

sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml

index 1a15db272d47ed5eb07fd1848e201c45c5a3f082..18297848cd6b10a1d1f8bf95a47b11e5d0bfdb87 100644 (file)
@@ -4,16 +4,16 @@
 <mapper namespace="org.sonar.core.properties.PropertiesMapper">
 
   <select id="findUsersForNotification" parameterType="map" resultType="String">
-    SELECT U.login
-    FROM properties P, users U
+    select u.login
+    from users u
+    inner join properties p on p.user_id=u.id
     <if test="projectUuid == null">
-      WHERE P.user_id = U.id AND P.prop_key = #{notifKey} AND P.text_value LIKE 'true'
-      AND P.resource_id is null
+      where p.prop_key = #{notifKey} and p.text_value LIKE 'true' and p.resource_id is null
     </if>
     <if test="projectUuid != null">
-      inner join projects c on c.id=P.resource_id
-      WHERE P.user_id = U.id AND P.prop_key = #{notifKey} AND P.text_value LIKE 'true'
-      AND c.uuid = #{projectUuid}
+      inner join projects c on c.id=p.resource_id
+      where p.prop_key = #{notifKey} AND p.text_value LIKE 'true'
+      and c.uuid = #{projectUuid} and p.resource_id is not null
     </if>
   </select>