Class BetweenOperatorNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.ValueNode
-
- org.apache.derby.impl.sql.compile.BinaryListOperatorNode
-
- org.apache.derby.impl.sql.compile.BetweenOperatorNode
-
- All Implemented Interfaces:
Visitable
class BetweenOperatorNode extends BinaryListOperatorNode
A BetweenOperatorNode represents a BETWEEN clause. The between values are represented as a 2 element list in order to take advantage of code reuse.
-
-
Field Summary
-
Fields inherited from class org.apache.derby.impl.sql.compile.BinaryListOperatorNode
leftOperand, methodName, operator, rightOperandList
-
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_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
-
-
Constructor Summary
Constructors Constructor Description BetweenOperatorNode(ValueNode leftOperand, ValueNodeList betweenValues, ContextManager cm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ValueNode
eliminateNots(boolean underNotNode)
Eliminate NotNodes in the current query block.(package private) void
generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
Do code generation for this BETWEEN operator.(package private) ValueNode
preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList)
Preprocess an expression tree.private static ValueNodeList
vetValues(ValueNodeList betweenValues)
-
Methods inherited from class org.apache.derby.impl.sql.compile.BinaryListOperatorNode
acceptChildren, bindComparisonOperator, bindExpression, categorize, constantExpression, getLeftOperand, getOrderableVariantType, getRightOperandList, isConstantExpression, isEquivalent, printSubNodes, remapColumnReferencesToExpressions, setLeftOperand, setRightOperandList, toString
-
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, evaluateConstantExpressions, genEqualsFalseTree, generate, genIsNullTree, genSQLJavaSQLTree, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeKind, optimizableEqualityNode, putAndsOnTop, requiresTypeFromContext, selectivity, setCollationInfo, setCollationInfo, setCollationUsingCompilationSchema, setCollationUsingCompilationSchema, setNullability, setTransformed, setType, setType, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
-
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Constructor Detail
-
BetweenOperatorNode
BetweenOperatorNode(ValueNode leftOperand, ValueNodeList betweenValues, ContextManager cm) throws StandardException
- Parameters:
leftOperand
- The left operand of the nodebetweenValues
- The between values in list formcm
-- Throws:
StandardException
-
-
Method Detail
-
vetValues
private static ValueNodeList vetValues(ValueNodeList betweenValues)
-
eliminateNots
ValueNode eliminateNots(boolean underNotNode) throws StandardException
Eliminate NotNodes in the current query block. We traverse the tree, inverting ANDs and ORs and eliminating NOTs as we go. We stop at ComparisonOperators and boolean expressions. We invert ComparisonOperators and replace boolean expressions with boolean expression = false. NOTE: Since we do not recurse under ComparisonOperators, there still could be NotNodes left in the tree.- Overrides:
eliminateNots
in classValueNode
- Parameters:
underNotNode
- Whether or not we are under a NotNode.- Returns:
- The modified expression
- Throws:
StandardException
- Thrown on error
-
preprocess
ValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException
Preprocess an expression tree. We do a number of transformations here (including subqueries, IN lists, LIKE and BETWEEN) plus subquery flattening. NOTE: This is done before the outer ResultSetNode is preprocessed.- Overrides:
preprocess
in classBinaryListOperatorNode
- Parameters:
numTables
- Number of tables in the DML StatementouterFromList
- FromList from outer query blockouterSubqueryList
- SubqueryList from outer query blockouterPredicateList
- PredicateList from outer query block- Returns:
- The modified expression
- Throws:
StandardException
- Thrown on error
-
generateExpression
void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
Do code generation for this BETWEEN operator.- Overrides:
generateExpression
in classValueNode
- Parameters:
acb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the code to place the code- Throws:
StandardException
- Thrown on error
-
-