Module bus.pager

Interface Dialect

All Known Implementing Classes:
AbstractDialect, AbstractPaging, AbstractRowBounds, AS400, CirroData, Db2, Db2RowBounds, Firebird, HerdDB, HerdDBRowBounds, Hsqldb, HsqldbRowBounds, Informix, InformixRowBounds, MySql, MySqlRowBounds, Oracle, Oracle9i, OracleRowBounds, Oscar, PageContext, PostgreSql, PostgreSqlRowBounds, SqlServer, SqlServer2012, SqlServer2012RowBounds, SqlServerRowBounds, Xugudb, XugudbRowBounds

public interface Dialect
Database dialect interface for different database implementations. This interface defines methods for handling pagination logic specific to various database systems.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called after all pagination tasks are completed.
    boolean
    afterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Called after the count query has been executed.
    afterPage(List pageList, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Called after the pagination query has been executed to process the results.
    default <T> Future<T>
    Executes an asynchronous count query task.
    boolean
    beforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Called before executing the count query.
    boolean
    beforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Called before executing the pagination query.
    getCountSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey countKey)
    Generates the SQL for the count query.
    getPageSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey)
    Generates the SQL for the paginated query.
    default boolean
    Checks if asynchronous count queries should be used.
    processParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey)
    Processes the parameter object before the query is executed.
    void
    Sets the properties for the dialect implementation.
    boolean
    skip(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
    Determines whether to skip the count query and pagination query.
  • Method Details

    • skip

      boolean skip(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Determines whether to skip the count query and pagination query.
      Parameters:
      ms - the MappedStatement object
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      Returns:
      true to skip and return default query results, false to proceed with pagination query
    • isAsyncCount

      default boolean isAsyncCount()
      Checks if asynchronous count queries should be used. If true, the count will be queried asynchronously and will not affect the decision to proceed with the pagination query.
      Returns:
      true for asynchronous count, false for synchronous
    • asyncCountTask

      default <T> Future<T> asyncCountTask(Callable<T> task)
      Executes an asynchronous count query task.
      Type Parameters:
      T - the type of the result of the task
      Parameters:
      task - the asynchronous query task
      Returns:
      a Future representing the pending completion of the task
    • beforeCount

      boolean beforeCount(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Called before executing the count query. If this method returns true, a count query will be performed. If it returns false, the system will proceed to evaluate the beforePage(MappedStatement, Object, RowBounds) method.
      Parameters:
      ms - the MappedStatement object
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      Returns:
      true to proceed with count query, false to skip to beforePage
    • getCountSql

      String getCountSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey countKey)
      Generates the SQL for the count query.
      Parameters:
      ms - the MappedStatement object
      boundSql - the BoundSql object containing the original SQL and parameters
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      countKey - the CacheKey for the count query
      Returns:
      the generated count SQL string
    • afterCount

      boolean afterCount(long count, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Called after the count query has been executed.
      Parameters:
      count - the total number of records found by the count query
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      Returns:
      true to continue with the pagination query, false to return immediately
    • processParameterObject

      Object processParameterObject(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.mapping.BoundSql boundSql, org.apache.ibatis.cache.CacheKey pageKey)
      Processes the parameter object before the query is executed.
      Parameters:
      ms - the MappedStatement object
      parameterObject - the parameter object for the query
      boundSql - the BoundSql object containing the original SQL and parameters
      pageKey - the CacheKey for the paginated query
      Returns:
      the processed parameter object
    • beforePage

      boolean beforePage(org.apache.ibatis.mapping.MappedStatement ms, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Called before executing the pagination query. If this method returns true, a pagination query will be performed. If it returns false, default query results will be returned.
      Parameters:
      ms - the MappedStatement object
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      Returns:
      true to proceed with pagination query, false to return default results
    • getPageSql

      String getPageSql(org.apache.ibatis.mapping.MappedStatement ms, org.apache.ibatis.mapping.BoundSql boundSql, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey)
      Generates the SQL for the paginated query.
      Parameters:
      ms - the MappedStatement object
      boundSql - the BoundSql object containing the original SQL and parameters
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      pageKey - the CacheKey for the paginated query
      Returns:
      the generated paginated SQL string
    • afterPage

      Object afterPage(List pageList, Object parameterObject, org.apache.ibatis.session.RowBounds rowBounds)
      Called after the pagination query has been executed to process the results. The return value of this method should be directly returned by the interceptor.
      Parameters:
      pageList - the list of results from the paginated query
      parameterObject - the parameter object for the query
      rowBounds - the RowBounds object containing pagination parameters
      Returns:
      the processed paginated results
    • afterAll

      void afterAll()
      Called after all pagination tasks are completed.
    • setProperties

      void setProperties(Properties properties)
      Sets the properties for the dialect implementation.
      Parameters:
      properties - the plugin properties