Class DB2QueryRewriter
- java.lang.Object
-
- org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.RowNumberQueryRewriter
-
- org.apache.metamodel.jdbc.dialects.DB2QueryRewriter
-
- All Implemented Interfaces:
IQueryRewriter
public class DB2QueryRewriter extends RowNumberQueryRewriter
Query rewriter for IBM DB2
-
-
Constructor Summary
Constructors Constructor Description DB2QueryRewriter(JdbcDataContext dataContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringescapeQuotes(String filterItemOperand)Escapes the quotes within a String literal of a query item.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.booleanisSchemaIncludedInColumnPaths()DB2 expects the fully qualified column name, including schema, in select items.StringrewriteColumnType(org.apache.metamodel.schema.ColumnType columnType, Integer columnSize)Rewrites the name of a column type, as it is written in CREATE TABLE statements.StringrewriteFilterItem(org.apache.metamodel.query.FilterItem item)StringrewriteQuery(org.apache.metamodel.query.Query query)-
Methods inherited from class org.apache.metamodel.jdbc.dialects.RowNumberQueryRewriter
getRowNumberSql
-
Methods inherited from class org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
beforeRewrite, isAggregateFunctionSupported, isPrimaryKeySupported, isScalarFunctionSupported, needsQuoting, rewriteFilterItemWithOperandLiteral, rewriteTimestamp
-
Methods inherited from class org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
getColumnType, getDataContext, getResultSetValue, isSupportedVersion, isTransactional, rewriteColumnTypeInternal, rewriteFromClause, rewriteFromItem, rewriteFromItem, rewriteGroupByClause, rewriteGroupByItem, rewriteHavingClause, rewriteOrderByClause, rewriteOrderByItem, rewriteSelectClause, rewriteSelectItem, rewriteWhereClause, setStatementParameter, toTime, toTimestamp
-
-
-
-
Constructor Detail
-
DB2QueryRewriter
public DB2QueryRewriter(JdbcDataContext dataContext)
-
-
Method Detail
-
escapeQuotes
public String escapeQuotes(String filterItemOperand)
Description copied from interface:IQueryRewriterEscapes the quotes within a String literal of a query item.- Specified by:
escapeQuotesin interfaceIQueryRewriter- Overrides:
escapeQuotesin classDefaultQueryRewriter- Returns:
- String item with quotes escaped.
-
isSchemaIncludedInColumnPaths
public boolean isSchemaIncludedInColumnPaths()
DB2 expects the fully qualified column name, including schema, in select items.- Overrides:
isSchemaIncludedInColumnPathsin classAbstractQueryRewriter
-
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.
-
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.
-
rewriteQuery
public String rewriteQuery(org.apache.metamodel.query.Query query)
- Specified by:
rewriteQueryin interfaceIQueryRewriter- Overrides:
rewriteQueryin classAbstractQueryRewriter
-
rewriteColumnType
public String rewriteColumnType(org.apache.metamodel.schema.ColumnType columnType, Integer columnSize)
Description copied from interface:IQueryRewriterRewrites the name of a column type, as it is written in CREATE TABLE statements. Some databases dont support all column types, or have different names for them. The implementation of this method will do that conversion.- Specified by:
rewriteColumnTypein interfaceIQueryRewriter- Overrides:
rewriteColumnTypein classDefaultQueryRewriter- Parameters:
columnType- the (non-null)ColumnTypeto rewritecolumnSize- the (possibly null) column size that may or may not have been specified- Returns:
-
rewriteFilterItem
public String rewriteFilterItem(org.apache.metamodel.query.FilterItem item)
- Specified by:
rewriteFilterItemin interfaceIQueryRewriter- Overrides:
rewriteFilterItemin classDefaultQueryRewriter
-
-