diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-21 09:49:45 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-11-21 09:49:45 +0100 |
commit | e6ec7cfad7ed7393451d6f0e239c347f5bff8dc8 (patch) | |
tree | da05958890b1abec44d7b4ab1845593620fa8669 | |
parent | bd6a947a986bc55f9cdea9bd78f87cbb6f446441 (diff) | |
download | sonarqube-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.java | 10 | ||||
-rw-r--r-- | sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml | 12 |
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 |