|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.query.sql.LanguageVisitor
com.metamatrix.query.sql.visitor.ExpressionMappingVisitor
com.metamatrix.query.rewriter.VariableSubstitutionVisitor
public class VariableSubstitutionVisitor
This visitor class will traverse a language object tree, it finds variables in the language
object and replaces the variable with a Reference
obj.,/p>
This will also evaluate special variables INPUT and CHANGING by looking at the user's query, it finds these special variables it replaces the variable with a value(in case of INPUT) of the corresponding variable in set the user command or replace it with a constant of boolean value (in case CHANGING) indicating if the variable value is set on the user's command.
The easiest way to use this visitor is to call the static method which creates the the visitor by passing it the Language Object and the variable context to be looked up. The public visit() methods should NOT be called directly.
Constructor Summary | |
---|---|
VariableSubstitutionVisitor(java.util.Map variableValues,
int commandType)
Construct a new visitor with the list of references. |
Method Summary | |
---|---|
Expression |
replaceExpression(Expression expr)
Common pattern used by visit methods in this Visitor |
static void |
substituteVariables(LanguageObject obj,
java.util.Map variableValues,
int commandType)
Helper to visit the language object specified and replace any variables a Reference obj, and collect the references returned. |
void |
visit(Update obj)
|
void |
visit(XQuery obj)
|
Methods inherited from class com.metamatrix.query.sql.visitor.ExpressionMappingVisitor |
---|
createAliases, getVariableValues, mapExpressions, setVariableValues, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class com.metamatrix.query.sql.LanguageVisitor |
---|
setAbort, shouldAbort, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VariableSubstitutionVisitor(java.util.Map variableValues, int commandType)
references
- A list of references on to be collectedMethod Detail |
---|
public void visit(XQuery obj)
visit
in class LanguageVisitor
public void visit(Update obj)
visit
in class LanguageVisitor
public Expression replaceExpression(Expression expr)
replaceExpression
in class ExpressionMappingVisitor
expr
-
public static final void substituteVariables(LanguageObject obj, java.util.Map variableValues, int commandType) throws QueryValidatorException
Helper to visit the language object specified and replace any variables a Reference obj, and collect the references returned.
obj
- The Language object that is to be visitedcommandType
- The command type of the user command invoking this procedureforwardReferences
- If references in the variable values should be substituted into expressions in this command
QueryValidatorException
QueryValidatorException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |