类 SqlPagingQueryUtils


  • public class SqlPagingQueryUtils
    extends java.lang.Object
    Utility class that generates the actual SQL statements used by query providers.
    从以下版本开始:
    2.0
    作者:
    Thomas Risberg, Dave Syer, Michael Minella
    • 方法详细资料

      • generateLimitSqlQuery

        public static java.lang.String generateLimitSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                             boolean remainingPageQuery,
                                                             java.lang.String limitClause)
        Generate SQL query string using a LIMIT clause
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        limitClause - the implementation specific limit clause to be used
        返回:
        the generated query
      • generateLimitGroupedSqlQuery

        public static java.lang.String generateLimitGroupedSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                                    boolean remainingPageQuery,
                                                                    java.lang.String limitClause)
        Generate SQL query string using a LIMIT clause
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        limitClause - the implementation specific limit clause to be used
        返回:
        the generated query
      • generateTopSqlQuery

        public static java.lang.String generateTopSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                           boolean remainingPageQuery,
                                                           java.lang.String topClause)
        Generate SQL query string using a TOP clause
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        topClause - the implementation specific top clause to be used
        返回:
        the generated query
      • generateGroupedTopSqlQuery

        public static java.lang.String generateGroupedTopSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                                  boolean remainingPageQuery,
                                                                  java.lang.String topClause)
        Generate SQL query string using a TOP clause
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        topClause - the implementation specific top clause to be used
        返回:
        the generated query
      • generateRowNumSqlQuery

        public static java.lang.String generateRowNumSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                              boolean remainingPageQuery,
                                                              java.lang.String rowNumClause)
        Generate SQL query string using a ROW_NUM condition
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        rowNumClause - the implementation specific row num clause to be used
        返回:
        the generated query
      • generateRowNumSqlQuery

        public static java.lang.String generateRowNumSqlQuery​(AbstractSqlPagingQueryProvider provider,
                                                              java.lang.String selectClause,
                                                              boolean remainingPageQuery,
                                                              java.lang.String rowNumClause)
        Generate SQL query string using a ROW_NUM condition
        参数:
        provider - AbstractSqlPagingQueryProvider providing the implementation specifics
        selectClause - String containing the select portion of the query.
        remainingPageQuery - is this query for the remaining pages (true) as opposed to the first page (false)
        rowNumClause - the implementation specific row num clause to be used
        返回:
        the generated query
      • buildSortClause

        public static java.lang.String buildSortClause​(java.util.Map<java.lang.String,​Order> sortKeys)
        Generates ORDER BY attributes based on the sort keys.
        参数:
        sortKeys - Map where the key is the name of the column to be sorted and the value contains the Order.
        返回:
        a String that can be appended to an ORDER BY clause.