aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-11-20 15:27:39 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-11-20 18:05:15 +0100
commit871a84da06a5d7f7d503376c0bad716e01a1d14d (patch)
treea61582a82eee68d7031de1bb0fa77bfaefe60fe7 /sonar-core/src
parent27a3f389a4b3227c087d93ad63cb9df903d350a7 (diff)
downloadsonarqube-871a84da06a5d7f7d503376c0bad716e01a1d14d.tar.gz
sonarqube-871a84da06a5d7f7d503376c0bad716e01a1d14d.zip
SONAR-5827 Select all previous file lines data hash with a single SQL query
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/source/db/FileSourceMapper.java4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/source/db/FileSourceMapper.xml8
2 files changed, 11 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/source/db/FileSourceMapper.java b/sonar-core/src/main/java/org/sonar/core/source/db/FileSourceMapper.java
index 302f727e369..916d662d212 100644
--- a/sonar-core/src/main/java/org/sonar/core/source/db/FileSourceMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/source/db/FileSourceMapper.java
@@ -22,8 +22,12 @@ package org.sonar.core.source.db;
import javax.annotation.CheckForNull;
+import java.util.List;
+
public interface FileSourceMapper {
+ List<FileSourceDto> selectAllFileDataHashByProject(String projectUuid);
+
@CheckForNull
FileSourceDto select(String fileUuid);
diff --git a/sonar-core/src/main/resources/org/sonar/core/source/db/FileSourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/source/db/FileSourceMapper.xml
index 033ab9ed648..4b3b88465c3 100644
--- a/sonar-core/src/main/resources/org/sonar/core/source/db/FileSourceMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/source/db/FileSourceMapper.xml
@@ -9,7 +9,13 @@
FROM file_sources
WHERE file_uuid = #{fileUuid}
</select>
-
+
+ <select id="selectAllFileDataHashByProject" parameterType="string" resultType="org.sonar.core.source.db.FileSourceDto">
+ SELECT id, file_uuid as fileUuid, data_hash as dataHash
+ FROM file_sources
+ WHERE project_uuid = #{projectUuid}
+ </select>
+
<insert id="insert" parameterType="org.sonar.core.source.db.FileSourceDto" useGeneratedKeys="false">
insert into file_sources (project_uuid, file_uuid, created_at, updated_at, data, data_hash)
values (#{projectUuid}, #{fileUuid}, #{createdAt}, #{updatedAt}, #{data}, #{dataHash})