Class OffsetFetchQueryRewriter
- java.lang.Object
-
- org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.OffsetFetchQueryRewriter
-
- All Implemented Interfaces:
IQueryRewriter
- Direct Known Subclasses:
OracleQueryRewriter,SQLServerQueryRewriter
public abstract class OffsetFetchQueryRewriter extends DefaultQueryRewriter
Query rewriter for databases that support OFFSET and FETCH keywords for max rows and first row properties.
-
-
Constructor Summary
Constructors Constructor Description OffsetFetchQueryRewriter(JdbcDataContext dataContext, int minSupportedVersion, boolean fetchNeedsOrderBy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisFirstRowSupported(org.apache.metamodel.query.Query query)Gets whether this query rewriter is able to write the "First row" query property to the query string.booleanisMaxRowsSupported()Gets whether this query rewriter is able to write the "Max rows" query property to the query string.StringrewriteQuery(org.apache.metamodel.query.Query query)If the Max rows and First row property of the query is set, then we will use the database's "OFFSET i ROWS FETCH NEXT j ROWS ONLY" construct.-
Methods inherited from class org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
beforeRewrite, escapeQuotes, isAggregateFunctionSupported, isPrimaryKeySupported, isScalarFunctionSupported, needsQuoting, rewriteColumnType, rewriteFilterItem, rewriteFilterItemWithOperandLiteral, rewriteTimestamp
-
Methods inherited from class org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
getColumnType, getDataContext, getResultSetValue, isSchemaIncludedInColumnPaths, isSupportedVersion, isTransactional, rewriteColumnTypeInternal, rewriteFromClause, rewriteFromItem, rewriteFromItem, rewriteGroupByClause, rewriteGroupByItem, rewriteHavingClause, rewriteOrderByClause, rewriteOrderByItem, rewriteSelectClause, rewriteSelectItem, rewriteWhereClause, setStatementParameter, toTime, toTimestamp
-
-
-
-
Constructor Detail
-
OffsetFetchQueryRewriter
public OffsetFetchQueryRewriter(JdbcDataContext dataContext, int minSupportedVersion, boolean fetchNeedsOrderBy)
-
-
Method Detail
-
isFirstRowSupported
public boolean isFirstRowSupported(org.apache.metamodel.query.Query query)
Description copied from interface:IQueryRewriterGets whether this query rewriter is able to write the "First row" query property to the query string.- Specified by:
isFirstRowSupportedin interfaceIQueryRewriter- Overrides:
isFirstRowSupportedin classDefaultQueryRewriter- Parameters:
query- For some database engines, the content of the query decides the ability to change first row- Returns:
- whether this query rewriter is able to write the "First row" query property to the query string.
-
isMaxRowsSupported
public boolean isMaxRowsSupported()
Description copied from interface:IQueryRewriterGets whether this query rewriter is able to write the "Max rows" query property to the query string.- Specified by:
isMaxRowsSupportedin interfaceIQueryRewriter- Overrides:
isMaxRowsSupportedin classDefaultQueryRewriter- Returns:
- whether this query rewriter is able to write the "Max rows" query property to the query string.
-
rewriteQuery
public String rewriteQuery(org.apache.metamodel.query.Query query)
If the Max rows and First row property of the query is set, then we will use the database's "OFFSET i ROWS FETCH NEXT j ROWS ONLY" construct.- Specified by:
rewriteQueryin interfaceIQueryRewriter- Overrides:
rewriteQueryin classAbstractQueryRewriter
-
-