- All Known Implementing Classes:
DefaultCountSqlParser
public interface CountSqlParser
SQL parsing interface for generating more intelligent count queries.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionA set of aggregate functions. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAggregateFunctions(String functions) Adds aggregate functions to the set.default StringgetSmartCountSql(String sql) Retrieves an intelligent count SQL statement.getSmartCountSql(String sql, String countColumn) Retrieves an intelligent count SQL statement.
-
Field Details
-
AGGREGATE_FUNCTIONS
A set of aggregate functions. Any function starting with these strings is considered an aggregate function.
-
-
Method Details
-
addAggregateFunctions
Adds aggregate functions to the set. Can be multiple comma-separated function prefixes.- Parameters:
functions- the functions to add
-
getSmartCountSql
Retrieves an intelligent count SQL statement.- Parameters:
sql- the original SQL statement- Returns:
- the generated count SQL string
-
getSmartCountSql
Retrieves an intelligent count SQL statement.- Parameters:
sql- the original SQL statementcountColumn- the column name to be used for the count, defaults to "0"- Returns:
- the generated count SQL string
-