|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ValueNode
org.apache.derby.impl.sql.compile.TernaryOperatorNode
org.apache.derby.impl.sql.compile.LikeEscapeOperatorNode
public final class LikeEscapeOperatorNode
This node represents a like comparison operator (no escape) If the like pattern is a constant or a parameter then if possible the like is modified to include a >= and < operator. In some cases the like can be eliminated. By adding =, >= or < operators it may allow indexes to be used to greatly narrow the search range of the query, and allow optimizer to estimate number of rows to affected. constant or parameter LIKE pattern with prefix followed by optional wild card e.g. Derby% CHAR(n), VARCHAR(n) where n < 255 >= prefix padded with ' ' to length n -- e.g. Derby <= prefix appended with '?' -- e.g. Derby? [ can eliminate LIKE if constant. ] CHAR(n), VARCHAR(n), LONG VARCHAR where n >= 255 >= prefix backed up one characer <= prefix appended with '?' no elimination of like parameter like pattern starts with wild card e.g. %Derby CHAR(n), VARCHAR(n) where n <= 256 >= ' ' padded with ' ' to length n <= '?' no elimination of like CHAR(n), VARCHAR(n), LONG VARCHAR where n > 256 >= NULL <= '?' Note that the Unicode value '?' is defined as not a character value and can be used by a program for any purpose. We use it to set an upper bound on a character range with a less than predicate. We only need a single '?' appended because the string 'Derby??' is not a valid String because '?' is not a valid character.
Field Summary | |
---|---|
(package private) boolean |
addedEquals
Fields of the class |
(package private) java.lang.String |
escape
|
Fields inherited from class org.apache.derby.impl.sql.compile.TernaryOperatorNode |
---|
leftInterfaceType, leftOperand, LIKE, LOCATE, methodName, operator, operatorType, receiver, receiverInterfaceType, resultInterfaceType, rightInterfaceType, rightOperand, SUBSTRING, TernaryArgType, TernaryMethodNames, TernaryOperators, TernaryResultType, TIMESTAMPADD, TIMESTAMPDIFF, TRIM, trimType |
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode |
---|
transformed |
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Constructor Summary | |
---|---|
LikeEscapeOperatorNode()
|
Method Summary | |
---|---|
void |
bindComparisonOperator()
Bind this operator |
ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
implement binding for like expressions. |
private void |
finishBindExpr()
|
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
Do code generation for this binary operator. |
void |
init(java.lang.Object receiver,
java.lang.Object leftOperand,
java.lang.Object rightOperand)
Initializer for a LikeEscapeOperatorNode receiver like pattern [ escape escapeValue ] |
ValueNode |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
Preprocess an expression tree. |
private ValueNode |
setupOptimizeStringFromParameter(ValueNode parameterNode,
ValueNode escapeNode,
java.lang.String methodName,
int maxWidth)
|
Methods inherited from class org.apache.derby.impl.sql.compile.TernaryOperatorNode |
---|
acceptChildren, bindToBuiltIn, castArgToString, categorize, constantExpression, getLeftOperand, getReceiver, getRightOperand, init, isConstantExpression, isEquivalent, locateBind, printSubNodes, remapColumnReferencesToExpressions, setLeftOperand, setRightOperand, substrBind, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
boolean addedEquals
java.lang.String escape
Constructor Detail |
---|
public LikeEscapeOperatorNode()
Method Detail |
---|
public void init(java.lang.Object receiver, java.lang.Object leftOperand, java.lang.Object rightOperand)
init
in class QueryTreeNode
receiver
- The left operand of the like:
column, CharConstant or ParameterleftOperand
- The right operand of the like: the patternrightOperand
- The optional escape clause, null if not presentpublic ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws StandardException
overrides BindOperatorNode.bindExpression because like has special requirements for parameter binding.
bindExpression
in class TernaryOperatorNode
fromList
- The FROM list for the query this
expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregateVector
- The aggregate vector being built as we find AggregateNodes
StandardException
- thrown on failureprivate void finishBindExpr() throws StandardException
StandardException
public void bindComparisonOperator() throws StandardException
StandardException
- Thrown on errorpublic ValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException
preprocess
in class TernaryOperatorNode
numTables
- Number of tables in the DML StatementouterFromList
- FromList from outer query blockouterSubqueryList
- SubqueryList from outer query blockouterPredicateList
- PredicateList from outer query block
StandardException
- Thrown on errorpublic void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class TernaryOperatorNode
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the code to place the code
StandardException
- Thrown on errorprivate ValueNode setupOptimizeStringFromParameter(ValueNode parameterNode, ValueNode escapeNode, java.lang.String methodName, int maxWidth) throws StandardException
StandardException
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |