aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-10-29 01:05:02 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-10-29 21:09:37 +0400
commit78e5033d8c535a357ef5e166afd1a00717aac5df (patch)
tree7374fc192fcdf171bd2f0838e35e4418235f9fb3
parentcce01f1629c24506cfaa115a4e2a9f157050b065 (diff)
downloadsonarqube-78e5033d8c535a357ef5e166afd1a00717aac5df.tar.gz
sonarqube-78e5033d8c535a357ef5e166afd1a00717aac5df.zip
SONAR-2642 Support Oracle DB for cross-project CPD
-rw-r--r--sonar-core/src/main/resources/org/sonar/persistence/model/DuplicationMapper-oracle.xml24
1 files changed, 24 insertions, 0 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/persistence/model/DuplicationMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/persistence/model/DuplicationMapper-oracle.xml
new file mode 100644
index 00000000000..659281dac7f
--- /dev/null
+++ b/sonar-core/src/main/resources/org/sonar/persistence/model/DuplicationMapper-oracle.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.persistence.model.DuplicationMapper">
+
+ <select id="selectCandidates" parameterType="map" resultType="DuplicationUnit">
+ SELECT DISTINCT to_blocks.hash hash, res.kee resourceKey, to_blocks.index_in_file indexInFile, to_blocks.start_line startLine, to_blocks.end_line endLine
+ FROM duplications_index to_blocks, duplications_index from_blocks, snapshots snapshot, projects res
+ WHERE from_blocks.snapshot_id = #{resource_snapshot_id}
+ AND to_blocks.hash = from_blocks.hash
+ AND to_blocks.snapshot_id = snapshot.id
+ AND snapshot.islast = TRUE
+ AND snapshot.project_id = res.id
+ <if test="last_project_snapshot_id != null">
+ AND to_blocks.project_snapshot_id != #{last_project_snapshot_id}
+ </if>
+ </select>
+
+ <insert id="insert" parameterType="DuplicationUnit" keyColumn="id" useGeneratedKeys="true">
+ INSERT INTO duplications_index (id, snapshot_id, project_snapshot_id, hash, index_in_file, start_line, end_line)
+ VALUES (select DUPLICATIONS_INDEX_SEQ.nextval, #{snapshotId}, #{projectSnapshotId}, #{hash}, #{indexInFile}, #{startLine}, #{endLine})
+ </insert>
+
+</mapper>