Fix clear methods in H2AccountPatchReviewStore

The typo in the 2 sql statements were causing to delete more than
expected because the change_id clause was always true.

Change-Id: I72334bd3798b6292a983321126382c3e65d8c3c6
This commit is contained in:
Hugo Arès
2017-04-25 10:15:47 +02:00
parent eba0fcccab
commit 7de517712e

View File

@@ -219,7 +219,7 @@ public class H2AccountPatchReviewStore
try (Connection con = ds.getConnection();
PreparedStatement stmt =
con.prepareStatement("DELETE FROM ACCOUNT_PATCH_REVIEWS "
+ "WHERE ACCOUNT_ID = ? AND CHANGE_ID + ? AND "
+ "WHERE ACCOUNT_ID = ? AND CHANGE_ID = ? AND "
+ "PATCH_SET_ID = ? AND FILE_NAME = ?")) {
stmt.setInt(1, accountId.get());
stmt.setInt(2, psId.getParentKey().get());
@@ -236,7 +236,7 @@ public class H2AccountPatchReviewStore
try (Connection con = ds.getConnection();
PreparedStatement stmt =
con.prepareStatement("DELETE FROM ACCOUNT_PATCH_REVIEWS "
+ "WHERE CHANGE_ID + ? AND PATCH_SET_ID = ?")) {
+ "WHERE CHANGE_ID = ? AND PATCH_SET_ID = ?")) {
stmt.setInt(1, psId.getParentKey().get());
stmt.setInt(2, psId.get());
stmt.executeUpdate();