Closes #2299 - remove lock from the query when unnecessary

This commit is contained in:
Elena Mokeeva 2023-06-20 13:49:50 +02:00 committed by Elena Mokeeva
parent e0ae4b9907
commit 1a965a0619
1 changed files with 5 additions and 5 deletions

View File

@ -70,9 +70,11 @@ public class TaskQuerySqlProvider {
+ "ORDER BY <foreach item='item' collection='orderByOuter' separator=',' >${item}</foreach>" + "ORDER BY <foreach item='item' collection='orderByOuter' separator=',' >${item}</foreach>"
+ "</if> " + "</if> "
+ "<if test='selectAndClaim == true'> " + "<if test='selectAndClaim == true'> "
+ "FETCH FIRST ROW ONLY FOR UPDATE" + "FETCH FIRST ROW ONLY FOR UPDATE "
+ "</if>" + "</if>"
+ "<if test=\"_databaseId == 'db2'\">WITH RS USE AND KEEP UPDATE LOCKS </if>" + "<if test=\"_databaseId == 'db2' and selectAndClaim \">WITH RS USE "
+ "AND KEEP UPDATE LOCKS </if>"
+ "<if test=\"_databaseId == 'db2' and !selectAndClaim \">WITH UR </if>"
+ CLOSING_SCRIPT_TAG; + CLOSING_SCRIPT_TAG;
} }
@ -429,9 +431,7 @@ public class TaskQuerySqlProvider {
} }
private static String openOuterClauseForGroupByPorOrSor() { private static String openOuterClauseForGroupByPorOrSor() {
return "<if test=\"groupByPor or groupBySor != null\"> " return "<if test=\"groupByPor or groupBySor != null\"> " + "SELECT * FROM (" + "</if> ";
+ "SELECT * FROM ("
+ "</if> ";
} }
private static String closeOuterClauseForGroupByPor() { private static String closeOuterClauseForGroupByPor() {