From: simonbrandhof Date: Wed, 18 May 2011 14:14:18 +0000 (+0200) Subject: Fix CloseReviewDecorator on SQL Server and Oracle X-Git-Tag: 2.8~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97276ac3cd1843a539672ae25118a4f9dd807c6c;p=sonarqube.git Fix CloseReviewDecorator on SQL Server and Oracle --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java index 1ee743bacb1..0b32e50b288 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/CloseReviewsDecorator.java @@ -81,8 +81,8 @@ public class CloseReviewsDecorator implements Decorator { } protected String generateUpdateOnProjectSqlRequest(int projectId, int projectSnapshotId) { - return "UPDATE reviews rv SET status='CLOSED', updated_at=CURRENT_TIMESTAMP WHERE rv.status='OPEN' AND rv.project_id=" + projectId - + " AND rv.resource_id IN ( SELECT prev.project_id FROM snapshots prev WHERE prev.root_project_id=" + projectId + return "UPDATE reviews SET status='CLOSED', updated_at=CURRENT_TIMESTAMP WHERE status='OPEN' AND project_id=" + projectId + + " AND resource_id IN ( SELECT prev.project_id FROM snapshots prev WHERE prev.root_project_id=" + projectId + " AND prev.islast=? AND NOT EXISTS ( SELECT cur.id FROM snapshots cur WHERE cur.root_snapshot_id=" + projectSnapshotId + " AND cur.created_at > prev.created_at AND cur.root_project_id=" + projectId + " AND cur.project_id=prev.project_id ) )"; }