aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-09-16 16:29:08 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-09-17 10:04:56 +0200
commit361c419cb05a0fcb1ba6840a3aab736bb3f65b86 (patch)
treeeb474bfad82031954942d0e0e3adafdd1b2ad3e0 /sonar-db
parent76b19e2f1e2ce590d0a93a5d42c7e0120bedc7bd (diff)
downloadsonarqube-361c419cb05a0fcb1ba6840a3aab736bb3f65b86.tar.gz
sonarqube-361c419cb05a0fcb1ba6840a3aab736bb3f65b86.zip
SONAR-6845 selectUuidsForQualifiers doesn't need SNAPSHOTS
As there's now an index on PROJECTS.QUALIFIER, it's no more required to do a join on SNAPSHOTS when searching for components by qualifier
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml4
-rw-r--r--sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml38
2 files changed, 1 insertions, 41 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml
index cc4c2d83500..a8c533f317b 100644
--- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml
@@ -262,11 +262,9 @@
<select id="selectUuidsForQualifiers" resultType="UuidWithProjectUuid">
SELECT p.uuid as "uuid", p.project_uuid as "projectUuid" FROM projects p
- INNER JOIN snapshots s on s.project_id=p.id AND s.islast=${_true}
<where>
- p.enabled=${_true} AND
<foreach collection="qualifiers" open="(" close=")" item="qualifier" separator="OR ">
- s.qualifier=#{qualifier}
+ p.qualifier=#{qualifier}
</foreach>
</where>
</select>
diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml
index d5b33924493..1eca3522d69 100644
--- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml
+++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml
@@ -3,71 +3,33 @@
<!-- Simple View -->
<projects id="10" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." copy_resource_id="[null]" enabled="[true]"
kee="MASTER_PROJECT" scope="PRJ" qualifier="VW" name="All projects" path="[null]"/>
- <snapshots id="10" project_id="10" parent_snapshot_id="[null]" root_project_id="10" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<projects id="110" uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." copy_resource_id="100" enabled="[true]"
kee="MASTER_PROJECTorg.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/>
- <snapshots id="110" project_id="110" parent_snapshot_id="[null]" root_project_id="110" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<!-- View with sub view -->
<projects id="11" uuid="EFGH" project_uuid="EFGH" module_uuid="[null]" module_uuid_path=".EFGH." copy_resource_id="[null]" enabled="[true]"
kee="LANGUAGE_VIEW" scope="PRJ" qualifier="VW" name="By Language" path="[null]"/>
- <snapshots id="11" project_id="11" parent_snapshot_id="[null]" root_project_id="11" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<projects id="112" uuid="GHIJ" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_resource_id="101" enabled="[true]"
kee="VIEW2org.elasticsearch:elasticsearch" scope="FIL" qualifier="TRK" name="SSLR" path="[null]"/>
- <snapshots id="112" project_id="112" parent_snapshot_id="[null]" root_project_id="112" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<!-- Sub view -->
<projects id="13" uuid="FGHI" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH.FGHI." copy_resource_id="[null]" enabled="[true]"
kee="JAVA_PROJECTS" scope="PRJ" qualifier="SVW" name="Java projects" path="[null]"/>
- <snapshots id="13" project_id="13" parent_snapshot_id="[null]" root_project_id="13" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="SVW" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<projects id="113" uuid="HIJK" project_uuid="EFGH" module_uuid="FGHI" module_uuid_path=".EFGH.FGHI." copy_resource_id="100" enabled="[true]"
kee="VIEW2org.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/>
- <snapshots id="113" project_id="113" parent_snapshot_id="[null]" root_project_id="113" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<!-- View without project -->
<projects id="14" uuid="IJKL" project_uuid="IJKL" module_uuid="[null]" module_uuid_path=".IJKL." copy_resource_id="[null]" enabled="[true]"
kee="OTHER" scope="PRJ" qualifier="VW" name="Other projects" path="[null]"/>
- <snapshots id="14" project_id="14" parent_snapshot_id="[null]" root_project_id="14" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
<!-- Real projects -->
-
<projects id="100" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts"
uuid="JKLM" project_uuid="JKLM" module_uuid="[null]" module_uuid_path=".JKLM."
enabled="[true]" copy_resource_id="[null]" path="[null]"/>
- <snapshots id="100" project_id="100" parent_snapshot_id="[null]" root_project_id="100" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
-
<projects id="101" scope="PRJ" qualifier="TRK" kee="org.elasticsearch:elasticsearch" name="Elasticsearch"
uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path=".KLMN."
enabled="[true]" copy_resource_id="[null]" path="[null]"/>
- <snapshots id="101" project_id="101" parent_snapshot_id="[null]" root_project_id="101" root_snapshot_id="[null]"
- status="P" islast="[true]" purge_status="[null]"
- depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000"
- version="[null]" path=""/>
</dataset>