public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, ParameterBinder.NamedParameterSource
SqlASTFactory
_tokenNames, _tokenSet_0, _tokenSet_1
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames
AGGREGATE, ALIAS, ALIAS_REF, ALL, AND, ANY, AS, ASCENDING, AVG, BETWEEN, BOGUS, BOTH, CASE, CASE2, CAST, CLASS, CLOSE, CLOSE_BRACKET, COLON, COMMA, CONCAT, CONSTANT, CONSTRUCTOR, COUNT, DELETE, DESCENDING, DISTINCT, DIV, DOT, ELEMENTS, ELSE, EMPTY, END, ENTRY, EOF, EQ, ESCAPE, ESCqs, EXISTS, EXPONENT, EXPR_LIST, FALSE, FETCH, FILTER_ENTITY, FILTERS, FIRST, FLOAT_SUFFIX, FROM, FROM_FRAGMENT, FULL, GE, GROUP, GT, HAVING, HEX_DIGIT, ID_LETTER, ID_START_LETTER, IDENT, IMPLIED_FROM, IN, IN_LIST, INDEX_OP, INDICES, INNER, INSERT, INTO, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, JOIN, JOIN_FRAGMENT, KEY, LAST, LE, LEADING, LEFT, LEFT_OUTER, LIKE, LITERAL_ascending, LITERAL_by, LITERAL_descending, LT, MAX, MEMBER, METHOD_CALL, METHOD_NAME, MIN, MINUS, MOD, NAMED_PARAM, NE, NEW, NOT, NOT_BETWEEN, NOT_IN, NOT_LIKE, NULL, NULL_TREE_LOOKAHEAD, NULLS, NUM_BIG_DECIMAL, NUM_BIG_INTEGER, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJECT, OF, ON, OPEN, OPEN_BRACKET, OR, ORDER, ORDER_ELEMENT, OUTER, PARAM, PLUS, PROPERTIES, PROPERTY_REF, QUERY, QUOTED_STRING, RANGE, RESULT_VARIABLE_REF, RIGHT, RIGHT_OUTER, ROW_STAR, SELECT, SELECT_CLAUSE, SELECT_COLUMNS, SELECT_EXPR, SELECT_FROM, SET, SOME, SQL_NE, SQL_TOKEN, STAR, SUM, THEN, THETA_JOINS, TRAILING, TRUE, UNARY_MINUS, UNARY_PLUS, UPDATE, VALUE, VECTOR_EXPR, VERSIONED, WEIRD_IDENT, WHEN, WHERE, WITH, WS
Constructor and Description |
---|
HqlSqlWalker(QueryTranslatorImpl qti,
SessionFactoryImplementor sfi,
HqlParser parser,
Map tokenReplacements,
String collectionRole)
Create a new tree transformer.
|
Modifier and Type | Method and Description |
---|---|
void |
addQuerySpaces(Serializable[] spaces) |
protected void |
beforeSelectClause() |
protected antlr.collections.AST |
createFromElement(String path,
antlr.collections.AST alias,
antlr.collections.AST propertyFetch) |
protected antlr.collections.AST |
createFromFilterElement(antlr.collections.AST filterEntity,
antlr.collections.AST alias) |
protected void |
createFromJoinElement(antlr.collections.AST path,
antlr.collections.AST alias,
int joinType,
antlr.collections.AST fetchNode,
antlr.collections.AST propertyFetch,
antlr.collections.AST with) |
protected antlr.collections.AST |
createIntoClause(String path,
antlr.collections.AST propertySpec) |
protected void |
evaluateAssignment(antlr.collections.AST eq) |
protected antlr.collections.AST |
generateNamedParameter(antlr.collections.AST delimiterNode,
antlr.collections.AST nameNode) |
protected antlr.collections.AST |
generatePositionalParameter(antlr.collections.AST inputNode) |
AliasGenerator |
getAliasGenerator() |
ArrayList |
getAssignmentSpecifications() |
ASTPrinter |
getASTPrinter() |
String |
getCollectionFilterRole() |
FromClause |
getCurrentFromClause() |
Map |
getEnabledFilters() |
FromClause |
getFinalFromClause() |
JoinType |
getImpliedJoinType() |
LiteralProcessor |
getLiteralProcessor() |
int[] |
getNamedParameterLocations(String name)
Returns the locations of all occurrences of the named parameter.
|
int |
getNumberOfParametersInSetClause() |
ArrayList<ParameterSpecification> |
getParameters() |
ParseErrorHandler |
getParseErrorHandler() |
Set<Serializable> |
getQuerySpaces()
Returns the set of unique query spaces (a.k.a.
|
String[] |
getReturnAliases() |
Type[] |
getReturnTypes() |
SelectClause |
getSelectClause() |
SessionFactoryHelper |
getSessionFactoryHelper() |
Map |
getTokenReplacements() |
Set<String> |
getTreatAsDeclarationsByPath(String path) |
protected void |
handleResultVariableRef(antlr.collections.AST resultVariableRef) |
boolean |
isFilter() |
boolean |
isInEntityGraph() |
protected boolean |
isNonQualifiedPropertyRef(antlr.collections.AST ident) |
protected boolean |
isOrderExpressionResultVariableRef(antlr.collections.AST orderExpressionNode) |
boolean |
isShallowQuery() |
protected void |
lookupAlias(antlr.collections.AST aliasRef) |
protected antlr.collections.AST |
lookupNonQualifiedProperty(antlr.collections.AST property) |
protected antlr.collections.AST |
lookupProperty(antlr.collections.AST dot,
boolean root,
boolean inSelect) |
static void |
panic() |
protected void |
postProcessDelete(antlr.collections.AST delete) |
protected void |
postProcessDML(RestrictableStatement statement) |
protected void |
postProcessInsert(antlr.collections.AST insert) |
protected void |
postProcessUpdate(antlr.collections.AST update) |
protected void |
prepareArithmeticOperator(antlr.collections.AST operator) |
protected void |
prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)
Pre-process the from clause input tree.
|
protected void |
prepareLogicOperator(antlr.collections.AST operator) |
protected void |
prepareVersioned(antlr.collections.AST updateNode,
antlr.collections.AST versioned) |
protected void |
processAggregation(antlr.collections.AST node,
boolean inSelect) |
protected void |
processBoolean(antlr.collections.AST constant) |
protected void |
processCastFunction(antlr.collections.AST castFunctionCall,
boolean inSelect) |
protected void |
processConstant(antlr.collections.AST constant) |
protected void |
processConstructor(antlr.collections.AST constructor) |
protected void |
processFunction(antlr.collections.AST functionCall,
boolean inSelect) |
protected void |
processIndex(antlr.collections.AST indexOp) |
protected void |
processNumericLiteral(antlr.collections.AST literal) |
protected void |
processQuery(antlr.collections.AST select,
antlr.collections.AST query) |
protected void |
pushFromClause(antlr.collections.AST fromNode,
antlr.collections.AST inputFromNode)
Sets the current 'FROM' context.
|
void |
reportError(antlr.RecognitionException e) |
void |
reportError(String s) |
void |
reportWarning(String s) |
protected void |
resolve(antlr.collections.AST node) |
protected void |
resolveSelectExpression(antlr.collections.AST node) |
protected void |
setAlias(antlr.collections.AST selectExpr,
antlr.collections.AST ident) |
protected void |
setImpliedJoinType(int joinType) |
void |
traceIn(String ruleName,
antlr.collections.AST tree) |
void |
traceOut(String ruleName,
antlr.collections.AST tree) |
protected void |
validateMapPropertyExpression(antlr.collections.AST node) |
addrExpr, addrExprLhs, aggregateExpr, aliasedSelectExpr, aliasRef, arithmeticExpr, assignment, caseExpr, collectionFunction, collectionFunctionOrSubselect, comparisonExpr, constant, constructor, count, deleteStatement, elseClause, expr, expressionOrSubQuery, exprOrSubquery, fromClause, fromElement, fromElementList, functionCall, getCurrentClauseType, getCurrentStatementType, getCurrentTopLevelClauseType, getStatementType, groupClause, identifier, inRhs, insertablePropertySpec, insertStatement, intoClause, isComparativeExpressionClause, isInCase, isInCount, isInCountDistinct, isInFrom, isInFunctionCall, isInSelect, isSelectStatement, isSubQuery, joinElement, joinType, literal, logicalExpr, mapComponentReference, mapPropertyExpression, newValue, nullOrdering, nullPrecedence, numericInteger, orderClause, orderExpr, orderExprs, parameter, path, pathAsIdent, processMapComponentReference, propertyName, propertyRef, propertyRefLhs, query, resultVariableRef, searchedCaseExpression, searchedCaseWhenClause, selectClause, selectExpr, selectExprList, selectStatement, setClause, simpleCaseExpression, simpleCaseWhenClause, statement, updateStatement, whereClause, withClause
public HqlSqlWalker(QueryTranslatorImpl qti, SessionFactoryImplementor sfi, HqlParser parser, Map tokenReplacements, String collectionRole)
qti
- Back pointer to the query translator implementation that is using this tree transform.sfi
- The session factory implementor where the Hibernate mappings can be found.parser
- A reference to the phase-1 parsertokenReplacements
- Registers the token replacement map with the walker. This map will
be used to substitute function names and constants.collectionRole
- The collection role name of the collection used as the basis for the
filter, NULL if this is not a collection filter compilation.public void traceIn(String ruleName, antlr.collections.AST tree)
traceIn
in class antlr.TreeParser
public void traceOut(String ruleName, antlr.collections.AST tree)
traceOut
in class antlr.TreeParser
protected void prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)
HqlSqlBaseWalker
prepareFromClauseInputTree
in class HqlSqlBaseWalker
public boolean isFilter()
public String getCollectionFilterRole()
public boolean isInEntityGraph()
public SessionFactoryHelper getSessionFactoryHelper()
public Map getTokenReplacements()
public AliasGenerator getAliasGenerator()
public FromClause getCurrentFromClause()
public ParseErrorHandler getParseErrorHandler()
public void reportError(antlr.RecognitionException e)
reportError
in interface ErrorReporter
reportError
in class antlr.TreeParser
public void reportError(String s)
reportError
in interface ErrorReporter
reportError
in class antlr.TreeParser
public void reportWarning(String s)
reportWarning
in interface ErrorReporter
reportWarning
in class antlr.TreeParser
public Set<Serializable> getQuerySpaces()
protected antlr.collections.AST createFromElement(String path, antlr.collections.AST alias, antlr.collections.AST propertyFetch) throws antlr.SemanticException
createFromElement
in class HqlSqlBaseWalker
antlr.SemanticException
protected antlr.collections.AST createFromFilterElement(antlr.collections.AST filterEntity, antlr.collections.AST alias) throws antlr.SemanticException
createFromFilterElement
in class HqlSqlBaseWalker
antlr.SemanticException
protected void createFromJoinElement(antlr.collections.AST path, antlr.collections.AST alias, int joinType, antlr.collections.AST fetchNode, antlr.collections.AST propertyFetch, antlr.collections.AST with) throws antlr.SemanticException
createFromJoinElement
in class HqlSqlBaseWalker
antlr.SemanticException
protected void pushFromClause(antlr.collections.AST fromNode, antlr.collections.AST inputFromNode)
pushFromClause
in class HqlSqlBaseWalker
fromNode
- The new 'FROM' context.inputFromNode
- The from node from the input AST.protected void lookupAlias(antlr.collections.AST aliasRef) throws antlr.SemanticException
lookupAlias
in class HqlSqlBaseWalker
antlr.SemanticException
protected void setImpliedJoinType(int joinType)
setImpliedJoinType
in class HqlSqlBaseWalker
public JoinType getImpliedJoinType()
protected antlr.collections.AST lookupProperty(antlr.collections.AST dot, boolean root, boolean inSelect) throws antlr.SemanticException
lookupProperty
in class HqlSqlBaseWalker
antlr.SemanticException
protected boolean isNonQualifiedPropertyRef(antlr.collections.AST ident)
isNonQualifiedPropertyRef
in class HqlSqlBaseWalker
protected antlr.collections.AST lookupNonQualifiedProperty(antlr.collections.AST property) throws antlr.SemanticException
lookupNonQualifiedProperty
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processQuery(antlr.collections.AST select, antlr.collections.AST query) throws antlr.SemanticException
processQuery
in class HqlSqlBaseWalker
antlr.SemanticException
protected void postProcessDML(RestrictableStatement statement) throws antlr.SemanticException
antlr.SemanticException
protected void postProcessUpdate(antlr.collections.AST update) throws antlr.SemanticException
postProcessUpdate
in class HqlSqlBaseWalker
antlr.SemanticException
protected void postProcessDelete(antlr.collections.AST delete) throws antlr.SemanticException
postProcessDelete
in class HqlSqlBaseWalker
antlr.SemanticException
protected void postProcessInsert(antlr.collections.AST insert) throws antlr.SemanticException, QueryException
postProcessInsert
in class HqlSqlBaseWalker
antlr.SemanticException
QueryException
protected void resolve(antlr.collections.AST node) throws antlr.SemanticException
resolve
in class HqlSqlBaseWalker
antlr.SemanticException
protected void resolveSelectExpression(antlr.collections.AST node) throws antlr.SemanticException
resolveSelectExpression
in class HqlSqlBaseWalker
antlr.SemanticException
protected void beforeSelectClause() throws antlr.SemanticException
beforeSelectClause
in class HqlSqlBaseWalker
antlr.SemanticException
protected antlr.collections.AST generatePositionalParameter(antlr.collections.AST inputNode) throws antlr.SemanticException
generatePositionalParameter
in class HqlSqlBaseWalker
antlr.SemanticException
protected antlr.collections.AST generateNamedParameter(antlr.collections.AST delimiterNode, antlr.collections.AST nameNode) throws antlr.SemanticException
generateNamedParameter
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processConstant(antlr.collections.AST constant) throws antlr.SemanticException
processConstant
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processBoolean(antlr.collections.AST constant) throws antlr.SemanticException
processBoolean
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processNumericLiteral(antlr.collections.AST literal)
processNumericLiteral
in class HqlSqlBaseWalker
protected void processIndex(antlr.collections.AST indexOp) throws antlr.SemanticException
processIndex
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processFunction(antlr.collections.AST functionCall, boolean inSelect) throws antlr.SemanticException
processFunction
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processCastFunction(antlr.collections.AST castFunctionCall, boolean inSelect) throws antlr.SemanticException
processCastFunction
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processAggregation(antlr.collections.AST node, boolean inSelect) throws antlr.SemanticException
processAggregation
in class HqlSqlBaseWalker
antlr.SemanticException
protected void processConstructor(antlr.collections.AST constructor) throws antlr.SemanticException
processConstructor
in class HqlSqlBaseWalker
antlr.SemanticException
protected void setAlias(antlr.collections.AST selectExpr, antlr.collections.AST ident)
setAlias
in class HqlSqlBaseWalker
protected boolean isOrderExpressionResultVariableRef(antlr.collections.AST orderExpressionNode) throws antlr.SemanticException
isOrderExpressionResultVariableRef
in class HqlSqlBaseWalker
antlr.SemanticException
protected void handleResultVariableRef(antlr.collections.AST resultVariableRef) throws antlr.SemanticException
handleResultVariableRef
in class HqlSqlBaseWalker
antlr.SemanticException
public int[] getNamedParameterLocations(String name) throws QueryException
getNamedParameterLocations
in interface ParameterBinder.NamedParameterSource
name
- The parameter nameQueryException
public void addQuerySpaces(Serializable[] spaces)
public Type[] getReturnTypes()
public String[] getReturnAliases()
public SelectClause getSelectClause()
public FromClause getFinalFromClause()
public boolean isShallowQuery()
public Map getEnabledFilters()
public LiteralProcessor getLiteralProcessor()
public ASTPrinter getASTPrinter()
public ArrayList<ParameterSpecification> getParameters()
public int getNumberOfParametersInSetClause()
protected void evaluateAssignment(antlr.collections.AST eq) throws antlr.SemanticException
evaluateAssignment
in class HqlSqlBaseWalker
antlr.SemanticException
public ArrayList getAssignmentSpecifications()
protected antlr.collections.AST createIntoClause(String path, antlr.collections.AST propertySpec) throws antlr.SemanticException
createIntoClause
in class HqlSqlBaseWalker
antlr.SemanticException
protected void prepareVersioned(antlr.collections.AST updateNode, antlr.collections.AST versioned) throws antlr.SemanticException
prepareVersioned
in class HqlSqlBaseWalker
antlr.SemanticException
protected void prepareLogicOperator(antlr.collections.AST operator) throws antlr.SemanticException
prepareLogicOperator
in class HqlSqlBaseWalker
antlr.SemanticException
protected void prepareArithmeticOperator(antlr.collections.AST operator) throws antlr.SemanticException
prepareArithmeticOperator
in class HqlSqlBaseWalker
antlr.SemanticException
protected void validateMapPropertyExpression(antlr.collections.AST node) throws antlr.SemanticException
validateMapPropertyExpression
in class HqlSqlBaseWalker
antlr.SemanticException
public static void panic()
Copyright © 2016 JBoss by Red Hat. All rights reserved.