org.apache.derby.impl.sql.compile
Class UntypedNullConstantNode

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.ValueNode
          extended byorg.apache.derby.impl.sql.compile.ConstantNode
              extended byorg.apache.derby.impl.sql.compile.UntypedNullConstantNode
All Implemented Interfaces:
Visitable

public final class UntypedNullConstantNode
extends ConstantNode

An UntypedNullConstantNode represents a SQL NULL before it has been bound. The bind() operation will replace the UntypedNullConstantNodes with typed ConstantNodes.


Field Summary
protected  DataValueDescriptor value
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.ValueNode
clause, dataTypeServices, IN_HAVING_CLAUSE, IN_SELECT_LIST, IN_UNKNOWN_CLAUSE, IN_WHERE_CLAUSE, transformed
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
UntypedNullConstantNode()
          Constructor for an UntypedNullConstantNode.
 
Method Summary
 ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector)
          Bind this expression.
 boolean constantExpression(PredicateList whereClause)
          Return whether or not this expression tree represents a constant value.
 DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
          Translate a Default node into a default value, given a type descriptor.
(package private)  void generateConstant(ExpressionClassBuilder acb, MethodBuilder mb)
          Should never be called for UntypedNullConstantNode because we shouldn't make it to generate
 void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
          For a ConstantNode, we generate the equivalent literal value.
 ValueNode getClone()
          Return a clone of this node.
protected  int getOrderableVariantType()
          Return the variant type for the underlying expression.
 DataValueDescriptor getValue()
          Get the value in this ConstantNode
 void init(java.lang.Object typeId, java.lang.Object nullable, java.lang.Object maximumWidth)
          Initializer for non-numeric types
 boolean isCloneable()
          Return whether or not this expression tree is cloneable.
 boolean isConstantExpression()
          Return whether or not this expression tree represents a constant expression.
 boolean isNull()
          Return whether or not this node represents a typed null constant.
(package private)  void setValue(DataValueDescriptor value)
          Set the value in this ConstantNode.
 java.lang.String toString()
          Convert this object to a String.
 
Methods inherited from class org.apache.derby.impl.sql.compile.ValueNode
bindExpression, categorize, changeToCNF, checkIsBoolean, checkReliability, checkReliability, checkTopPredicatesForEqualsConditions, copyFields, eliminateNots, genEqualsFalseTree, generate, generateFilter, genIsNullTree, genSQLJavaSQLTree, getClause, getColumnName, getConstantValueAsObject, getDataValueFactory, getSchemaName, getSourceResultColumn, getTableName, getTablesReferenced, getTransformed, getTypeCompiler, getTypeId, getTypeServices, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isParameterNode, isRelationalOperator, optimizableEqualityNode, preprocess, putAndsOnTop, remapColumnReferencesToExpressions, selectivity, setClause, setDescriptor, setTransformed, setType, updatableByCursor, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, bind, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeResultDescription, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected DataValueDescriptor value
Constructor Detail

UntypedNullConstantNode

public UntypedNullConstantNode()
Constructor for an UntypedNullConstantNode. Untyped constants contain no state (not too surprising).

Method Detail

generateConstant

void generateConstant(ExpressionClassBuilder acb,
                      MethodBuilder mb)
Should never be called for UntypedNullConstantNode because we shouldn't make it to generate

Specified by:
generateConstant in class ConstantNode
Parameters:
acb - The ExpressionClassBuilder for the class being built
mb - The method the expression will go into
Returns:
The compiled Expression,

convertDefaultNode

public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)
Translate a Default node into a default value, given a type descriptor.

Overrides:
convertDefaultNode in class QueryTreeNode
Parameters:
typeDescriptor - A description of the required data type.

bindExpression

public ValueNode bindExpression(FromList fromList,
                                SubqueryList subqueryList,
                                java.util.Vector aggregateVector)
Description copied from class: ConstantNode
Bind this expression. This means binding the sub-expressions, as well as figuring out what the return type is for this expression. In this case, there are no sub-expressions, and the return type is already known, so this is just a stub.

Overrides:
bindExpression in class ConstantNode
Parameters:
fromList - The FROM list for the query this expression is in, for binding columns.
subqueryList - The subquery list being built as we find SubqueryNodes
aggregateVector - The aggregate vector being built as we find AggregateNodes
Returns:
The new top of the expression tree.
See Also:
ValueNode.bindExpression(FromList, SubqueryList, Vector), This does nothing-- the node is actually bound when bindUntypedNullsToResultColumns is called.

init

public void init(java.lang.Object typeId,
                 java.lang.Object nullable,
                 java.lang.Object maximumWidth)
          throws StandardException
Initializer for non-numeric types

Overrides:
init in class QueryTreeNode
Parameters:
typeId - The Type ID of the datatype
nullable - True means the constant is nullable
maximumWidth - The maximum number of bytes in the data value
Throws:
StandardException

setValue

void setValue(DataValueDescriptor value)
Set the value in this ConstantNode.


getValue

public DataValueDescriptor getValue()
Get the value in this ConstantNode


toString

public java.lang.String toString()
Convert this object to a String. See comments in QueryTreeNode.java for how this should be done for tree printing.

Overrides:
toString in class ValueNode
Returns:
This object as a String

isCloneable

public boolean isCloneable()
Return whether or not this expression tree is cloneable.

Overrides:
isCloneable in class ValueNode
Returns:
boolean Whether or not this expression tree is cloneable.

getClone

public ValueNode getClone()
Return a clone of this node.

Overrides:
getClone in class ValueNode
Returns:
ValueNode A clone of this node.

isConstantExpression

public boolean isConstantExpression()
Return whether or not this expression tree represents a constant expression.

Overrides:
isConstantExpression in class ValueNode
Returns:
Whether or not this expression tree represents a constant expression.

constantExpression

public boolean constantExpression(PredicateList whereClause)
Description copied from class: ValueNode
Return whether or not this expression tree represents a constant value. In this case, "constant" means that it will always evaluate to the same thing, even if it includes columns. A column is constant if it is compared to a constant expression.

Overrides:
constantExpression in class ValueNode
Returns:
True means this expression tree represents a constant value.
See Also:
ValueNode.constantExpression(org.apache.derby.impl.sql.compile.PredicateList)

generateExpression

public void generateExpression(ExpressionClassBuilder acb,
                               MethodBuilder mb)
                        throws StandardException
For a ConstantNode, we generate the equivalent literal value. A null is generated as a Null value cast to the type of the constant node. The subtypes of ConstantNode generate literal expressions for non-null values.

Overrides:
generateExpression in class ValueNode
Parameters:
acb - The ExpressionClassBuilder for the class being built
mb - The method the code to place the code
Returns:
The compiled Expression, if the constant is a null value, null if the constant is not a null value (confusing, huh?)
Throws:
StandardException - Thrown on error

isNull

public boolean isNull()
Return whether or not this node represents a typed null constant.


getOrderableVariantType

protected int getOrderableVariantType()
Return the variant type for the underlying expression. The variant type can be: VARIANT - variant within a scan (method calls and non-static field access) SCAN_INVARIANT - invariant within a scan (column references from outer tables) QUERY_INVARIANT - invariant within the life of a query VARIANT - immutable

Overrides:
getOrderableVariantType in class ValueNode
Returns:
The variant type for the underlying expression.

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.