aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-11-21 09:49:45 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-11-21 09:49:45 +0100
commite6ec7cfad7ed7393451d6f0e239c347f5bff8dc8 (patch)
treeda05958890b1abec44d7b4ab1845593620fa8669
parentbd6a947a986bc55f9cdea9bd78f87cbb6f446441 (diff)
downloadsonarqube-e6ec7cfad7ed7393451d6f0e239c347f5bff8dc8.tar.gz
sonarqube-e6ec7cfad7ed7393451d6f0e239c347f5bff8dc8.zip
SONAR-3287 fix compatibility with Oracle
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreDto.java10
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml12
2 files changed, 22 insertions, 0 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreDto.java b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreDto.java
index 01f84aa3902..77434345069 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreDto.java
@@ -27,6 +27,7 @@ import java.util.Date;
* @since 3.4
*/
public class SemaphoreDto {
+ private Long id;
private String name;
private String checksum;
private Date lockedAt;
@@ -49,4 +50,13 @@ public class SemaphoreDto {
this.lockedAt = d;
return this;
}
+
+ public Long getId() {
+ return id;
+ }
+
+ public SemaphoreDto setId(Long id) {
+ this.id = id;
+ return this;
+ }
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml
index bd56b88be1c..cf824381d16 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml
@@ -8,10 +8,22 @@
VALUES (#{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt})
</insert>
+ <insert id="initialize" databaseId="oracle" parameterType="map" useGeneratedKeys="false">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select semaphores_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO semaphores (id, name, checksum, created_at, updated_at, locked_at)
+ VALUES (#{id}, #{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt})
+ </insert>
+
<select id="now" resultType="Date">
select current_timestamp
</select>
+ <select id="now" databaseId="oracle" resultType="Date">
+ select current_timestamp from dual
+ </select>
+
<update id="acquire" parameterType="map">
update semaphores
set updated_at = current_timestamp, locked_at = current_timestamp