aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-24 15:38:34 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-24 15:38:34 +0200
commit9127a969b26ae71ae88b9113b65130285042c95a (patch)
treef23863ee18ffbfabebd24940301e6c57581beb49 /sonar-core
parent5449ddfa363cfe06e5ad58a9c16d38f482f424c7 (diff)
downloadsonarqube-9127a969b26ae71ae88b9113b65130285042c95a.tar.gz
sonarqube-9127a969b26ae71ae88b9113b65130285042c95a.zip
SONAR-4301 Fix sql query
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml32
1 files changed, 19 insertions, 13 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
index caa04f88709..6bcaf25261f 100644
--- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
@@ -146,12 +146,25 @@
</where>
</select>
- <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="2147483647">
- select
- <if test="_databaseId == 'mssql' ">
- top #{maxResults}
- </if>
- i.id, i.project_id as projectId
+ <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="1000000">
+ select i.id, i.project_id as projectId
+ <include refid="sortColumn"/>
+ <include refid="selectQueryConditions"/>
+ limit #{maxResults}
+ </select>
+
+ <!-- Oracle -->
+ <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="1000000" databaseId="oracle">
+ select * from (
+ select i.id, i.project_id as projectId
+ <include refid="sortColumn"/>
+ <include refid="selectQueryConditions"/>
+ ) where rownum &lt;= #{maxResults}
+ </select>
+
+ <!-- SQL Server -->
+ <select id="selectIssueAndProjectIds" parameterType="map" resultType="Issue" fetchSize="1000000" databaseId="mssql">
+ select top #{maxResults} i.id, i.project_id as projectId
<include refid="sortColumn"/>
<include refid="selectQueryConditions"/>
</select>
@@ -275,14 +288,7 @@
<if test="query.createdBefore() != null">
and i.issue_creation_date &lt; #{query.createdBefore}
</if>
- <if test="_databaseId == 'oracle' ">
- and rownum &lt;= #{maxResults}
- </if>
</where>
- order by i.id
- <if test="_databaseId != 'oracle' and _databaseId != 'mssql'">
- limit #{maxResults}
- </if>
</sql>
</mapper>