Top Fields Constructors Methods
org.apache.derby.impl.sql.compile

public final Class NumericConstantNode

extends ConstantNode
Class Inheritance
Imports
java.math.BigDecimal, java.sql.Types, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.types.DataTypeUtilities, .NumberDataValue, .SQLDecimal, .SQLDouble, .SQLInteger, .SQLLongint, .SQLReal, .SQLSmallint, .SQLTinyint, .TypeId

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv final int
kind

This class is used to hold logically different objects for space efficiency.

Inherited from org.apache.derby.impl.sql.compile.ConstantNode:
value

Constructor Summary

AccessConstructor and Description
pack-priv
NumericConstantNode(TypeId
type
t
,
ContextManager
context manager
cm
)

Constructor for a typed null node

pack-priv
NumericConstantNode(TypeId t, Number
An object containing the value of the constant.
value
,
ContextManager
context manager
cm
)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
generateConstant(ExpressionClassBuilder
The ExpressionClassBuilder for the class being built
acb
,
MethodBuilder
The method the expression will go into
mb
)

Implements abstract org.apache.derby.impl.sql.compile.ConstantNode.generateConstant.

This generates the proper constant.

pack-priv Object

Returns:

An Object representing the bind time value of this expression tree. (null if not a bind time constant.)
getConstantValueAsObject
()

Overrides org.apache.derby.impl.sql.compile.ValueNode.getConstantValueAsObject.

Return an Object representing the bind time value of this expression tree.

private int
private int
private int
private int
pack-priv boolean
isSameNodeKind(ValueNode
The other value node whose kind we want to compare with.
o
)

Overrides org.apache.derby.impl.sql.compile.ValueNode.isSameNodeKind.

Some node classes represent several logical node types (to reduce footprint), which we call kinds.

private void
Inherited from org.apache.derby.impl.sql.compile.ConstantNode:
bindExpressionconstantExpressiongenerateExpressiongetClonegetOrderableVariantTypegetValueisCloneableisConstantExpressionisEquivalentisNullsetValuetoString

Field Detail

K_BIGINTback to summary
pack-priv static final int K_BIGINT
K_DECIMALback to summary
pack-priv static final int K_DECIMAL
K_DOUBLEback to summary
pack-priv static final int K_DOUBLE
K_INTback to summary
pack-priv static final int K_INT
K_REALback to summary
pack-priv static final int K_REAL
K_SMALLINTback to summary
pack-priv static final int K_SMALLINT
K_TINYINTback to summary
pack-priv static final int K_TINYINT
kindback to summary
pack-priv final int kind

This class is used to hold logically different objects for space efficiency. kind represents the logical object type. See also ValueNode#isSameNodeKind.

Constructor Detail

NumericConstantNodeback to summary
pack-priv NumericConstantNode(TypeId t, ContextManager cm) throws StandardException

Constructor for a typed null node

Parameters
t:TypeId

type

cm:ContextManager

context manager

NumericConstantNodeback to summary
pack-priv NumericConstantNode(TypeId t, Number value, ContextManager cm) throws StandardException
Parameters
value:Number

An object containing the value of the constant.

cm:ContextManager

context manager

Method Detail

generateConstantback to summary
pack-priv void generateConstant(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException

Implements abstract org.apache.derby.impl.sql.compile.ConstantNode.generateConstant.

This generates the proper constant. It is implemented by every specific constant node (e.g. IntConstantNode).

Parameters
acb:ExpressionClassBuilder

The ExpressionClassBuilder for the class being built

mb:MethodBuilder

The method the expression will go into

Exceptions
StandardException:
Thrown on error
getConstantValueAsObjectback to summary
pack-priv Object getConstantValueAsObject() throws StandardException

Overrides org.apache.derby.impl.sql.compile.ValueNode.getConstantValueAsObject.

Return 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?

Returns:Object

An Object representing the bind time value of this expression tree. (null if not a bind time constant.)

Annotations
@Override
Exceptions
StandardException:
Thrown on error
getKindback to summary
private int getKind(TypeId t)
getMaxWidthback to summary
private int getMaxWidth(TypeId t, Object val) throws StandardException
getPrecisionback to summary
private int getPrecision(TypeId t, Number val) throws StandardException
getScaleback to summary
private int getScale(TypeId t, Object val) throws StandardException
isSameNodeKindback to summary
pack-priv boolean isSameNodeKind(ValueNode o)

Overrides org.apache.derby.impl.sql.compile.ValueNode.isSameNodeKind.

Doc from org.apache.derby.impl.sql.compile.ValueNode.isSameNodeKind.

Some node classes represent several logical node types (to reduce footprint), which we call kinds. This means that implementations of isEquivalent cannot always just use instanceof to 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 of isEquivalent.

Parameters
o:ValueNode

The other value node whose kind we want to compare with.

Returns:boolean

true if this and o represent the same logical node type, i.e. kind.

Annotations
@Override
setValueback to summary
private void setValue(TypeId t, Number value) throws StandardException