Module bus.pager

Interface CountSqlParser

All Known Implementing Classes:
DefaultCountSqlParser

public interface CountSqlParser
SQL parsing interface for generating more intelligent count queries.
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • AGGREGATE_FUNCTIONS

      static final Set<String> AGGREGATE_FUNCTIONS
      A set of aggregate functions. Any function starting with these strings is considered an aggregate function.
  • Method Details

    • addAggregateFunctions

      static void addAggregateFunctions(String functions)
      Adds aggregate functions to the set. Can be multiple comma-separated function prefixes.
      Parameters:
      functions - the functions to add
    • getSmartCountSql

      default String getSmartCountSql(String sql)
      Retrieves an intelligent count SQL statement.
      Parameters:
      sql - the original SQL statement
      Returns:
      the generated count SQL string
    • getSmartCountSql

      String getSmartCountSql(String sql, String countColumn)
      Retrieves an intelligent count SQL statement.
      Parameters:
      sql - the original SQL statement
      countColumn - the column name to be used for the count, defaults to "0"
      Returns:
      the generated count SQL string