Class NumericConstantNode
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.QueryTreeNode
-
- org.apache.derby.impl.sql.compile.ValueNode
-
- org.apache.derby.impl.sql.compile.ConstantNode
-
- org.apache.derby.impl.sql.compile.NumericConstantNode
-
- All Implemented Interfaces:
Visitable
public final class NumericConstantNode extends ConstantNode
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intK_BIGINT(package private) static intK_DECIMAL(package private) static intK_DOUBLE(package private) static intK_INT(package private) static intK_REAL(package private) static intK_SMALLINT(package private) static intK_TINYINT(package private) intkindThis class is used to hold logically different objects for space efficiency.-
Fields inherited from class org.apache.derby.impl.sql.compile.ConstantNode
value
-
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 NumericConstantNode(TypeId t, java.lang.Number value, ContextManager cm)NumericConstantNode(TypeId t, ContextManager cm)Constructor for a typed null node
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidgenerateConstant(ExpressionClassBuilder acb, MethodBuilder mb)This generates the proper constant.(package private) java.lang.ObjectgetConstantValueAsObject()Return an Object representing the bind time value of this expression tree.private intgetKind(TypeId t)private intgetMaxWidth(TypeId t, java.lang.Object val)private intgetPrecision(TypeId t, java.lang.Number val)private intgetScale(TypeId t, java.lang.Object val)(package private) booleanisSameNodeKind(ValueNode o)Some node classes represent several logical node types (to reduce footprint), which we call kinds.private voidsetValue(TypeId t, java.lang.Number value)-
Methods inherited from class org.apache.derby.impl.sql.compile.ConstantNode
bindExpression, constantExpression, generateExpression, getClone, getOrderableVariantType, getValue, isCloneable, isConstantExpression, isEquivalent, isNull, setValue, toString
-
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, categorize, changeToCNF, checkIsBoolean, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, evaluateConstantExpressions, genEqualsFalseTree, generate, genIsNullTree, genSQLJavaSQLTree, getColumnName, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isInListProbeNode, isParameterNode, isRelationalOperator, optimizableEqualityNode, preprocess, putAndsOnTop, remapColumnReferencesToExpressions, 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, acceptChildren, 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, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
-
-
-
-
Field Detail
-
K_TINYINT
static final int K_TINYINT
- See Also:
- Constant Field Values
-
K_SMALLINT
static final int K_SMALLINT
- See Also:
- Constant Field Values
-
K_INT
static final int K_INT
- See Also:
- Constant Field Values
-
K_BIGINT
static final int K_BIGINT
- See Also:
- Constant Field Values
-
K_DECIMAL
static final int K_DECIMAL
- See Also:
- Constant Field Values
-
K_DOUBLE
static final int K_DOUBLE
- See Also:
- Constant Field Values
-
K_REAL
static final int K_REAL
- See Also:
- Constant Field Values
-
kind
final int kind
This class is used to hold logically different objects for space efficiency.kindrepresents the logical object type. See alsoValueNode.isSameNodeKind(org.apache.derby.impl.sql.compile.ValueNode).
-
-
Constructor Detail
-
NumericConstantNode
NumericConstantNode(TypeId t, ContextManager cm) throws StandardException
Constructor for a typed null node- Parameters:
t- typecm- context manager- Throws:
StandardException
-
NumericConstantNode
NumericConstantNode(TypeId t, java.lang.Number value, ContextManager cm) throws StandardException
- Parameters:
value- An object containing the value of the constant.cm- context manager- Throws:
StandardException
-
-
Method Detail
-
getPrecision
private int getPrecision(TypeId t, java.lang.Number val) throws StandardException
- Throws:
StandardException
-
getScale
private int getScale(TypeId t, java.lang.Object val) throws StandardException
- Throws:
StandardException
-
getMaxWidth
private int getMaxWidth(TypeId t, java.lang.Object val) throws StandardException
- Throws:
StandardException
-
getKind
private int getKind(TypeId t)
-
setValue
private void setValue(TypeId t, java.lang.Number value) throws StandardException
- Throws:
StandardException
-
getConstantValueAsObject
java.lang.Object getConstantValueAsObject() throws StandardExceptionReturn an Object representing the bind time value of this expression tree. If the expression tree does not evaluate to a constant at bind time then we return null. This is useful for bind time resolution of VTIs. RESOLVE: What do we do for primitives?- Overrides:
getConstantValueAsObjectin classValueNode- Returns:
- An Object representing the bind time value of this expression tree. (null if not a bind time constant.)
- Throws:
StandardException- Thrown on error
-
generateConstant
void generateConstant(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
This generates the proper constant. It is implemented by every specific constant node (e.g. IntConstantNode).- Specified by:
generateConstantin classConstantNode- Parameters:
acb- The ExpressionClassBuilder for the class being builtmb- The method the expression will go into- Throws:
StandardException- Thrown on error
-
isSameNodeKind
boolean isSameNodeKind(ValueNode o)
Description copied from class:ValueNodeSome node classes represent several logical node types (to reduce footprint), which we call kinds. This means that implementations ofValueNode.isEquivalent(org.apache.derby.impl.sql.compile.ValueNode)cannot always just useinstanceofto check if the other node represents the same kind. Hence this method needs to be overridden by all node classes that represent several kinds. This default implementation does not look at kinds. It is only called from implementations ofisEquivalent.- Overrides:
isSameNodeKindin classValueNode- Parameters:
o- The other value node whose kind we want to compare with.- Returns:
trueifthisandorepresent the same logical node type, i.e. kind.
-
-