public class ResultColumn extends ValueNode
The type of the ResultColumn can differ from its underlying expression, for example in certain joins the ResultColumn can be nullable even if its underlying column is not. In an INSERT or UPDATE the ResultColumn will represent the type of the column in the table, the type of the underlying expresion will be the type of the source of the value to be insert or updated. The method columnTypeAndLengthMatch() can be used to detect when normalization is required between the expression and the tyoe of ResultColumn. This class does not implement any type normalization (conversion), this is typically handled by a NormalizeResultSetNode.
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
ResultColumn() |
Modifier and Type | Method and Description |
---|---|
void |
adjustVirtualColumnId(int adjust)
Adjust the virtualColumnId for this ResultColumn by the specified amount
|
void |
copyFrom(QueryTreeNode node)
Fill this node with a deep copy of the given node.
|
int |
getColumnPosition() |
ValueNode |
getExpression()
Get the expression in this ResultColumn.
|
java.lang.String |
getName()
The following methods implement the ResultColumnDescriptor
interface.
|
ColumnReference |
getReference() |
java.lang.String |
getSchemaName()
This returns the user-supplied schema name of the column.
|
java.lang.String |
getTableName()
This returns the user-supplied table name of the column.
|
TableName |
getTableNameObject() |
int |
getVirtualColumnId()
Get the virtualColumnId for this ResultColumn
|
void |
init(java.lang.Object arg1,
java.lang.Object arg2)
Different types of initializer parameters indicate different
types of initialization.
|
boolean |
isDefaultColumn()
Returns TRUE if the ResultColumn is standing in for a DEFAULT keyword in
an insert/update statement.
|
boolean |
isEquivalent(ValueNode o)
Tests if this node is equivalent to the specified ValueNode.
|
boolean |
isNameGenerated()
Is the name for this ResultColumn generated?
|
void |
printSubNodes(int depth)
Prints the sub-nodes of this object.
|
void |
setDefaultColumn(boolean value) |
void |
setExpression(ValueNode expression)
Set the expression in this ResultColumn.
|
void |
setName(java.lang.String name)
Set the name in this ResultColumn.
|
void |
setNameGenerated(boolean value)
Set that this result column name is generated.
|
void |
setVirtualColumnId(int id)
Set the virtualColumnId for this ResultColumn
|
java.lang.String |
toString()
Convert this object to a String.
|
getColumnName, getSourceResultColumn, getType, getTypeId, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isConstantExpression, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeType, setNullability, setType
accept, convertDefaultNode, debugFlush, debugPrint, formatNodeString, getBeginOffset, getDebugOutput, getEndOffset, getNodeFactory, getNodeType, getNullNode, getParserContext, getStatementType, getUserData, init, init, init, init, init, init, init, init, init, init, init, init, isInstanceOf, makeTableName, makeTableName, nodeHeader, printLabel, setBeginOffset, setDebugOutput, setEndOffset, setNodeType, setParserContext, setUserData, stackPrint, treePrint, treePrint, treePrint
public void init(java.lang.Object arg1, java.lang.Object arg2) throws StandardException
- OR -
- OR -
- OR -
init
in class QueryTreeNode
StandardException
- Thrown on errorpublic void copyFrom(QueryTreeNode node) throws StandardException
copyFrom
in class ValueNode
StandardException
public boolean isDefaultColumn()
public void setDefaultColumn(boolean value)
public java.lang.String getName()
public java.lang.String getSchemaName() throws StandardException
ValueNode
getSchemaName
in class ValueNode
StandardException
public java.lang.String getTableName()
ValueNode
getTableName
in class ValueNode
public int getColumnPosition()
public void setExpression(ValueNode expression)
expression
- The expression to be set in this ResultColumnpublic ValueNode getExpression()
public void setName(java.lang.String name)
name
- The name to set in this ResultColumnpublic boolean isNameGenerated()
public void setNameGenerated(boolean value)
public void adjustVirtualColumnId(int adjust)
adjust
- The adjustment for the virtualColumnIdpublic void setVirtualColumnId(int id)
id
- The virtualColumnId for this ResultColumnpublic int getVirtualColumnId()
public java.lang.String toString()
public void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the treepublic TableName getTableNameObject()
public ColumnReference getReference()
public boolean isEquivalent(ValueNode o) throws StandardException
ValueNode
This method provides basic expression matching facility for the derived class of ValueNode and it is used by the language layer to compare the node structural form of the two expressions for equivalence at bind phase.
Note that it is not comparing the actual row values at runtime to produce a result; hence, when comparing SQL NULLs, they are considered to be equivalent and not unknown.
One usage case of this method in this context is to compare the select column expression against the group by expression to check if they are equivalent. e.g.:
SELECT c1+c2 FROM t1 GROUP BY c1+c2
In general, node equivalence is determined by the derived class of ValueNode. But they generally abide to the rules below:
isEquivalent
in class ValueNode
o
- the node to compare this ValueNode against.true
if the two nodes are equivalent,
false
otherwise.StandardException
Copyright © 2013. All Rights Reserved.