Remove unused parameter in SqlPagingQueryUtils#generateLimitGroupedSqlQuery
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2012 the original author or authors.
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Db2PagingQueryProvider extends SqlWindowingPagingQueryProvider {
|
||||
@@ -37,7 +38,7 @@ public class Db2PagingQueryProvider extends SqlWindowingPagingQueryProvider {
|
||||
@Override
|
||||
public String generateRemainingPagesQuery(int pageSize) {
|
||||
if(StringUtils.hasText(getGroupClause())) {
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, buildLimitClause(pageSize));
|
||||
}
|
||||
else {
|
||||
return SqlPagingQueryUtils.generateLimitSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2012 the original author or authors.
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MySqlPagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
@@ -36,7 +37,7 @@ public class MySqlPagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
@Override
|
||||
public String generateRemainingPagesQuery(int pageSize) {
|
||||
if(StringUtils.hasText(getGroupClause())) {
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, buildLimitClause(pageSize));
|
||||
}
|
||||
else {
|
||||
return SqlPagingQueryUtils.generateLimitSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2012 the original author or authors.
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class PostgresPagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
@@ -38,7 +39,7 @@ public class PostgresPagingQueryProvider extends AbstractSqlPagingQueryProvider
|
||||
@Override
|
||||
public String generateRemainingPagesQuery(int pageSize) {
|
||||
if(StringUtils.hasText(getGroupClause())) {
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, buildLimitClause(pageSize));
|
||||
}
|
||||
else {
|
||||
return SqlPagingQueryUtils.generateLimitSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Risberg
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SqlPagingQueryUtils {
|
||||
@@ -67,7 +68,9 @@ public class SqlPagingQueryUtils {
|
||||
* opposed to the first page (false)
|
||||
* @param limitClause the implementation specific limit clause to be used
|
||||
* @return the generated query
|
||||
* @deprecated in favor of {@link #generateLimitGroupedSqlQuery(AbstractSqlPagingQueryProvider, java.lang.String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static String generateLimitGroupedSqlQuery(AbstractSqlPagingQueryProvider provider, boolean remainingPageQuery,
|
||||
String limitClause) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
@@ -86,6 +89,31 @@ public class SqlPagingQueryUtils {
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL query string using a LIMIT clause
|
||||
*
|
||||
* @param provider {@link AbstractSqlPagingQueryProvider} providing the
|
||||
* implementation specifics
|
||||
* @param limitClause the implementation specific limit clause to be used
|
||||
* @return the generated query
|
||||
*/
|
||||
public static String generateLimitGroupedSqlQuery(AbstractSqlPagingQueryProvider provider, String limitClause) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT * ");
|
||||
sql.append(" FROM (");
|
||||
sql.append("SELECT ").append(provider.getSelectClause());
|
||||
sql.append(" FROM ").append(provider.getFromClause());
|
||||
sql.append(provider.getWhereClause() == null ? "" : " WHERE " + provider.getWhereClause());
|
||||
buildGroupByClause(provider, sql);
|
||||
sql.append(") AS MAIN_QRY ");
|
||||
sql.append("WHERE ");
|
||||
buildSortConditions(provider, sql);
|
||||
sql.append(" ORDER BY ").append(buildSortClause(provider));
|
||||
sql.append(" " + limitClause);
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL query string using a TOP clause
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import org.springframework.util.StringUtils;
|
||||
* features.
|
||||
*
|
||||
* @author Luke Taylor
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class SqlitePagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
@@ -40,7 +41,7 @@ public class SqlitePagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
@Override
|
||||
public String generateRemainingPagesQuery(int pageSize) {
|
||||
if(StringUtils.hasText(getGroupClause())) {
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
return SqlPagingQueryUtils.generateLimitGroupedSqlQuery(this, buildLimitClause(pageSize));
|
||||
}
|
||||
else {
|
||||
return SqlPagingQueryUtils.generateLimitSqlQuery(this, true, buildLimitClause(pageSize));
|
||||
|
||||
Reference in New Issue
Block a user