org.apache.metamodel.jdbc.dialects
Class DefaultQueryRewriter

java.lang.Object
  extended by org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
      extended by org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter
All Implemented Interfaces:
IQueryRewriter
Direct Known Subclasses:
DB2QueryRewriter, HsqldbQueryRewriter, LimitOffsetQueryRewriter, SQLServerQueryRewriter

public class DefaultQueryRewriter
extends AbstractQueryRewriter

Generic query rewriter that adds syntax enhancements that are only possible to resolve just before execution time.


Field Summary
 
Fields inherited from class org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
logger
 
Constructor Summary
DefaultQueryRewriter(JdbcDataContext dataContext)
           
 
Method Summary
protected  Query beforeRewrite(Query query)
          Method to modify query before rewriting begins.
 String escapeQuotes(String item)
          Escapes the quotes within a String literal of a query item.
 boolean isFirstRowSupported()
          Gets whether this query rewriter is able to write the "First row" query property to the query string.
 boolean isMaxRowsSupported()
          Gets whether this query rewriter is able to write the "Max rows" query property to the query string.
 String rewriteFilterItem(FilterItem item)
           
 
Methods inherited from class org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter
getColumnType, getDataContext, isSchemaIncludedInColumnPaths, rewriteColumnType, rewriteFromClause, rewriteFromItem, rewriteFromItem, rewriteGroupByClause, rewriteGroupByItem, rewriteHavingClause, rewriteOrderByClause, rewriteOrderByItem, rewriteQuery, rewriteSelectClause, rewriteSelectItem, rewriteWhereClause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultQueryRewriter

public DefaultQueryRewriter(JdbcDataContext dataContext)
Method Detail

beforeRewrite

protected Query beforeRewrite(Query query)
Description copied from class: AbstractQueryRewriter
Method to modify query before rewriting begins. Overwrite this method if you want to change parts of the query that are not just rendering related. Cloning the query before modifying is recommended in order to not violate referential integrity of clients (the query is mutable).

Overrides:
beforeRewrite in class AbstractQueryRewriter
Returns:
the modified query

rewriteFilterItem

public String rewriteFilterItem(FilterItem item)
Specified by:
rewriteFilterItem in interface IQueryRewriter
Overrides:
rewriteFilterItem in class AbstractQueryRewriter

isFirstRowSupported

public boolean isFirstRowSupported()
Description copied from interface: IQueryRewriter
Gets whether this query rewriter is able to write the "First row" query property to the query string.

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: IQueryRewriter
Gets whether this query rewriter is able to write the "Max rows" query property to the query string.

Returns:
whether this query rewriter is able to write the "Max rows" query property to the query string.

escapeQuotes

public String escapeQuotes(String item)
Description copied from interface: IQueryRewriter
Escapes the quotes within a String literal of a query item.

Returns:
String item with quotes escaped.


Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.