Class LimitOffsetQueryRewriter
- java.lang.Object
-
- org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.LimitOffsetQueryRewriter
-
- All Implemented Interfaces:
IQueryRewriter
- Direct Known Subclasses:
H2QueryRewriter,Hive2QueryRewriter,MysqlQueryRewriter,PostgresqlQueryRewriter
public abstract class LimitOffsetQueryRewriter extends DefaultQueryRewriter
Query rewriter for databases that support LIMIT and OFFSET keywords for max rows and first row properties.
-
-
Constructor Summary
Constructors Constructor Description LimitOffsetQueryRewriter(JdbcDataContext dataContext)
-
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/or First row property of the query is set, then we will use the database's LIMIT and OFFSET functions.-
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
-
LimitOffsetQueryRewriter
public LimitOffsetQueryRewriter(JdbcDataContext dataContext)
-
-
Method Detail
-
isFirstRowSupported
public final 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 final 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/or First row property of the query is set, then we will use the database's LIMIT and OFFSET functions.- Specified by:
rewriteQueryin interfaceIQueryRewriter- Overrides:
rewriteQueryin classAbstractQueryRewriter
-
-