|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.drinkjava2.jdialects.hibernatesrc.pagination.AbstractLimitHandler
public abstract class AbstractLimitHandler
Default implementation of LimitHandler interface.
| Constructor Summary | |
|---|---|
protected |
AbstractLimitHandler()
|
| Method Summary | |
|---|---|
protected int |
bindLimitParameters(RowSelection selection,
PreparedStatement statement,
int index)
Default implementation of binding parameter values needed by the LIMIT clause. |
int |
bindLimitParametersAtEndOfQuery(RowSelection selection,
PreparedStatement statement,
int index)
Bind parameter values needed by the LIMIT clause afterQuery original SELECT statement. |
int |
bindLimitParametersAtStartOfQuery(RowSelection selection,
PreparedStatement statement,
int index)
Bind parameter values needed by the LIMIT clause beforeQuery original SELECT statement. |
boolean |
bindLimitParametersFirst()
Does the LIMIT clause come at the start of the SELECT statement, rather than at the end? |
boolean |
bindLimitParametersInReverseOrder()
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. |
int |
convertToFirstRowValue(int zeroBasedFirstResult)
Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. |
boolean |
forceLimitUsage()
Generally, if there is no limit applied to a Hibernate query we do not apply any limits to the SQL query. |
protected int |
getMaxOrLimit(RowSelection selection)
Some dialect-specific LIMIT clauses require the maximum last row number (aka, first_row_number + total_row_count), while others require the maximum returned row count (the total maximum number of rows to return). |
String |
processSql(String sql,
RowSelection selection)
Return processed SQL query. |
void |
setMaxRows(RowSelection selection,
PreparedStatement statement)
Use JDBC API to limit the number of rows returned by the SQL query. |
boolean |
supportsLimit()
Does this handler support some form of limiting query results via a SQL clause? |
boolean |
supportsLimitOffset()
Does this handler's LIMIT support (if any) additionally support specifying an offset? |
boolean |
supportsVariableLimit()
Does this handler support bind variables (i.e., prepared statement parameters) for its limit/offset? |
boolean |
useMaxForLimit()
Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows? This is easiest understood via an example. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractLimitHandler()
| Method Detail |
|---|
public boolean supportsLimit()
LimitHandler
supportsLimit in interface LimitHandlerpublic boolean supportsLimitOffset()
LimitHandler
supportsLimitOffset in interface LimitHandlerpublic boolean supportsVariableLimit()
public boolean bindLimitParametersInReverseOrder()
public boolean bindLimitParametersFirst()
public boolean useMaxForLimit()
public boolean forceLimitUsage()
public int convertToFirstRowValue(int zeroBasedFirstResult)
AbstractLimitHandler#processSql(String, com.github.drinkjava2.jdialects.hibernatesrc.pagination.hibernate.engine.spi.RowSelection) is the zero-based offset.
Dialects which do not supportsVariableLimit() should take care to perform any needed first-row-conversion
calls prior to injecting the limit values into the SQL string.
zeroBasedFirstResult - The user-supplied, zero-based first row offset.
org.hibernate.Query#setFirstResult,
org.hibernate.Criteria#setFirstResult
public String processSql(String sql,
RowSelection selection)
LimitHandler
processSql in interface LimitHandlersql - the SQL query to process.selection - the selection criteria for rows.
public int bindLimitParametersAtStartOfQuery(RowSelection selection,
PreparedStatement statement,
int index)
throws SQLException
LimitHandler
bindLimitParametersAtStartOfQuery in interface LimitHandlerselection - the selection criteria for rows.statement - Statement to which to bind limit parameter values.index - Index from which to start binding.
SQLException - Indicates problems binding parameter values.
public int bindLimitParametersAtEndOfQuery(RowSelection selection,
PreparedStatement statement,
int index)
throws SQLException
LimitHandler
bindLimitParametersAtEndOfQuery in interface LimitHandlerselection - the selection criteria for rows.statement - Statement to which to bind limit parameter values.index - Index from which to start binding.
SQLException - Indicates problems binding parameter values.
public void setMaxRows(RowSelection selection,
PreparedStatement statement)
throws SQLException
LimitHandler
setMaxRows in interface LimitHandlerselection - the selection criteria for rows.statement - Statement which number of returned rows shall be limited.
SQLException - Indicates problems while limiting maximum rows returned.
protected final int bindLimitParameters(RowSelection selection,
PreparedStatement statement,
int index)
throws SQLException
selection - the selection criteria for rows.statement - Statement to which to bind limit parameter values.index - Index from which to start binding.
SQLException - Indicates problems binding parameter values.protected final int getMaxOrLimit(RowSelection selection)
selection - the selection criteria for rows.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||