]> source.dussan.org Git - sonarqube.git/commitdiff
Fix SQL request for MSSQL and Postgres
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 28 Jun 2016 07:35:02 +0000 (09:35 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 28 Jun 2016 07:35:02 +0000 (09:35 +0200)
sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml

index 49646233f04f443f47c2b7dc0b5dbb9483517c92..31b71fecbab685ca10e6999c4ac98b99413e7555 100644 (file)
     select
     <include refid="componentColumns"/>
     from projects base
-    inner join projects p
+    inner join projects p on p.project_uuid = base.project_uuid
     where
     base.uuid = #{query.baseUuid}
-    and p.project_uuid = base.project_uuid
     and base.uuid_path like #{baseUuidPathLike}
     and p.uuid != base.uuid
     and p.enabled = ${_true}
 
   <sql id="sqlChildren">
     from projects p
-    inner join projects base
-    inner join snapshots s
+    inner join projects base on base.project_uuid = p.project_uuid
+    inner join snapshots s on s.component_uuid = base.project_uuid
     where
     base.uuid = #{query.baseUuid}
-    and base.project_uuid = p.project_uuid
-    and s.component_uuid = base.project_uuid
     and p.enabled = ${_true}
     and s.islast = ${_true}
     and p.uuid_path = #{baseUuidPath}
 
   <sql id="sqlDescendants">
     from projects p
-    inner join projects base
-    inner join snapshots s
+    inner join projects base on base.project_uuid=p.project_uuid
+    inner join snapshots s on s.component_uuid = base.project_uuid
     where
     base.uuid = #{query.baseUuid}
-    and base.project_uuid=p.project_uuid
     and p.enabled = ${_true}
     and p.uuid_path like #{baseUuidPathLike} ESCAPE '/'
-    and s.component_uuid = base.project_uuid
     and s.islast = ${_true}
     <include refid="sqlTreeFilters"/>
   </sql>