Class Oracle12LimitHandler

  • All Implemented Interfaces:
    LimitHandler

    public class Oracle12LimitHandler
    extends AbstractLimitHandler
    A LimitHandler for databases which support the ANSI SQL standard syntax FETCH FIRST m ROWS ONLY and OFFSET n ROWS FETCH NEXT m ROWS ONLY.
    • Field Detail

      • bindLimitParametersInReverseOrder

        public boolean bindLimitParametersInReverseOrder
      • useMaxForLimit

        public boolean useMaxForLimit
    • Method Detail

      • processSql

        public java.lang.String processSql​(java.lang.String sql,
                                           RowSelection selection)
        Description copied from interface: LimitHandler
        Return processed SQL query.
        Specified by:
        processSql in interface LimitHandler
        Overrides:
        processSql in class AbstractLimitHandler
        Parameters:
        sql - the SQL query to process.
        selection - the selection criteria for rows.
        Returns:
        Query statement with LIMIT clause applied.
      • processSql

        public java.lang.String processSql​(java.lang.String sql,
                                           QueryParameters queryParameters)
        Description copied from interface: LimitHandler
        Return processed SQL query.
        Parameters:
        sql - the SQL query to process.
        queryParameters - the queryParameters.
        Returns:
        Query statement with LIMIT clause applied.
      • supportsLimit

        public final boolean supportsLimit()
        Description copied from interface: LimitHandler
        Does this handler support some form of limiting query results via a SQL clause?
        Specified by:
        supportsLimit in interface LimitHandler
        Overrides:
        supportsLimit in class AbstractLimitHandler
        Returns:
        True if this handler supports some form of LIMIT.
      • bindLimitParametersInReverseOrder

        public boolean bindLimitParametersInReverseOrder()
        Description copied from class: AbstractLimitHandler
        ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. Does this dialect require us to bind the parameters in reverse order?
        Overrides:
        bindLimitParametersInReverseOrder in class AbstractLimitHandler
        Returns:
        true if the correct order is limit, offset
      • useMaxForLimit

        public boolean useMaxForLimit()
        Description copied from class: AbstractLimitHandler
        Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?

        This is easiest understood via an example. Consider you have a table with 20 rows, but you only want to retrieve rows number 11 through 20. Generally, a limit with offset would say that the offset = 11 and the limit = 10 (we only want 10 rows at a time); this is specifying the total number of returned rows. Some dialects require that we instead specify offset = 11 and limit = 20, where 20 is the "last" row we want relative to offset (i.e. total number of rows = 20 - 11 = 9)

        So essentially, is limit relative from offset? Or is limit absolute?

        Overrides:
        useMaxForLimit in class AbstractLimitHandler
        Returns:
        True if limit is relative from offset; false otherwise.