Module bus.pager

Class SqlServerRowBounds

All Implemented Interfaces:
Dialect
Direct Known Subclasses:
SqlServer2012RowBounds

public class SqlServerRowBounds extends AbstractRowBounds
SQL Server dialect for pagination based on RowBounds. This class provides SQL Server-specific SQL generation for pagination using offset and limit.
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • sqlServerSqlParser

      protected SqlServerSqlParser sqlServerSqlParser
      SQL Server specific SQL parser for pagination.
    • replaceSql

      protected ReplaceSql replaceSql
      Utility for replacing and restoring SQL parts, especially for `with(nolock)`.
  • Constructor Details

    • SqlServerRowBounds

      public SqlServerRowBounds()
  • Method Details

    • getCountSql

      public 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 for SQL Server. It applies SQL replacement rules before and after generating the count SQL.
      Specified by:
      getCountSql in interface Dialect
      Overrides:
      getCountSql in class AbstractDialect
      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
    • getPageSql

      public String getPageSql(String sql, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.cache.CacheKey pageKey)
      Generates the SQL Server-specific pagination SQL using RowBounds. It applies SQL replacement rules, converts the SQL to a paginated form, and substitutes pagination parameters.
      Specified by:
      getPageSql in class AbstractRowBounds
      Parameters:
      sql - the original SQL string
      rowBounds - the RowBounds object containing offset and limit
      pageKey - the CacheKey for the paginated query
      Returns:
      the SQL Server-specific paginated SQL string
    • setProperties

      public void setProperties(Properties properties)
      Sets the properties for this SQL Server RowBounds dialect. It initializes the SqlServerSqlParser and ReplaceSql implementation.
      Specified by:
      setProperties in interface Dialect
      Overrides:
      setProperties in class AbstractRowBounds
      Parameters:
      properties - the properties to set