java.lang.Object
org.miaixz.bus.pager.parsing.DefaultOrderBySqlParser
- All Implemented Interfaces:
OrderBySqlParser
Default implementation of
OrderBySqlParser for handling Order by clauses.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconverToOrderBySql(String sql, String orderBy) Converts a SQL statement to include an ORDER BY clause.static List<net.sf.jsqlparser.statement.select.OrderByElement> extraOrderBy(net.sf.jsqlparser.statement.select.Select select) Extracts the ORDER BY elements from a SELECT statement and sets the default order by to null.
-
Constructor Details
-
DefaultOrderBySqlParser
public DefaultOrderBySqlParser()
-
-
Method Details
-
extraOrderBy
public static List<net.sf.jsqlparser.statement.select.OrderByElement> extraOrderBy(net.sf.jsqlparser.statement.select.Select select) Extracts the ORDER BY elements from a SELECT statement and sets the default order by to null.- Parameters:
select- the SELECT statement- Returns:
- the list of
OrderByElements
-
converToOrderBySql
Converts a SQL statement to include an ORDER BY clause. If the original SQL contains an ORDER BY clause with parameters, it throws aPageException. If parsing fails, it falls back to appending the ORDER BY clause directly.- Specified by:
converToOrderBySqlin interfaceOrderBySqlParser- Parameters:
sql- the original SQL statementorderBy- the ORDER BY clause to be added- Returns:
- the modified SQL statement with the ORDER BY clause
-