update db2 'between' logic to be exclusive Signed-off-by: Ryan DCruz <rd@enfuse.io> use .acceptLicense() instead of the classpath file checkstyle add test to verify a result set that's smaller than requested page size cleanup
This commit is contained in:
committed by
Glenn Renfro
parent
62cccc2727
commit
fc89e23144
@@ -24,6 +24,7 @@ import org.springframework.data.domain.Pageable;
|
||||
* database specific features.
|
||||
*
|
||||
* @author Thomas Schuettel
|
||||
* @author Ryan DCruz
|
||||
*/
|
||||
public class Db2PagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
|
||||
@@ -31,8 +32,7 @@ public class Db2PagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
public String getPageQuery(Pageable pageable) {
|
||||
long offset = pageable.getOffset() + 1;
|
||||
return generateRowNumSqlQueryWithNesting(getSelectClause(), false,
|
||||
"TMP_ROW_NUM BETWEEN " + offset + " AND "
|
||||
+ (offset + pageable.getPageSize()));
|
||||
"TMP_ROW_NUM >= " + offset + " AND TMP_ROW_NUM < " + (offset + pageable.getPageSize()));
|
||||
}
|
||||
|
||||
private String generateRowNumSqlQueryWithNesting(String selectClause,
|
||||
|
||||
@@ -30,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Glenn Renfro
|
||||
* @author Ryan DCruz
|
||||
*/
|
||||
public class FindAllPagingQueryProviderTests {
|
||||
|
||||
@@ -66,7 +67,16 @@ public class FindAllPagingQueryProviderTests {
|
||||
+ "OVER (ORDER BY START_TIME DESC, TASK_EXECUTION_ID DESC) AS "
|
||||
+ "TMP_ROW_NUM FROM %PREFIX%EXECUTION) TASK_EXECUTION_PAGE "
|
||||
+ "WHERE TMP_ROW_NUM >= 1 AND TMP_ROW_NUM < 11 ORDER BY START_TIME DESC, "
|
||||
+ "TASK_EXECUTION_ID DESC" } });
|
||||
+ "TASK_EXECUTION_ID DESC" },
|
||||
{ "DB2/Linux",
|
||||
"SELECT TASK_EXECUTION_ID, START_TIME, END_TIME, "
|
||||
+ "TASK_NAME, EXIT_CODE, EXIT_MESSAGE, ERROR_MESSAGE, LAST_UPDATED, EXTERNAL_EXECUTION_ID, PARENT_EXECUTION_ID FROM "
|
||||
+ "(SELECT TASK_EXECUTION_ID, START_TIME, END_TIME, TASK_NAME, "
|
||||
+ "EXIT_CODE, EXIT_MESSAGE, ERROR_MESSAGE, LAST_UPDATED, EXTERNAL_EXECUTION_ID, PARENT_EXECUTION_ID, ROW_NUMBER() "
|
||||
+ "OVER() as TMP_ROW_NUM FROM "
|
||||
+ "(SELECT TASK_EXECUTION_ID, START_TIME, END_TIME, TASK_NAME, EXIT_CODE, EXIT_MESSAGE, ERROR_MESSAGE, LAST_UPDATED, "
|
||||
+ "EXTERNAL_EXECUTION_ID, PARENT_EXECUTION_ID FROM %PREFIX%EXECUTION ORDER BY START_TIME DESC, TASK_EXECUTION_ID DESC)) "
|
||||
+ "WHERE TMP_ROW_NUM >= 1 AND TMP_ROW_NUM < 11"}});
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
||||
Reference in New Issue
Block a user