|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.akiban.sql.parser.QueryTreeNode
com.akiban.sql.parser.ValueNode
com.akiban.sql.parser.ResultColumn
public class ResultColumn
A ResultColumn represents a result column in a SELECT, INSERT, or UPDATE statement. In a SELECT statement, the result column just represents an expression in a row being returned to the client. For INSERT and UPDATE statements, the result column represents an column in a stored table. So, a ResultColumn has to be bound differently depending on the type of statement it appears in.
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.
| Field Summary |
|---|
| Fields inherited from class com.akiban.sql.parser.QueryTreeNode |
|---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX |
| Constructor Summary | |
|---|---|
ResultColumn()
|
|
| Method Summary | |
|---|---|
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. |
String |
getName()
The following methods implement the ResultColumnDescriptor interface. |
ColumnReference |
getReference()
|
String |
getSchemaName()
This returns the user-supplied schema name of the column. |
String |
getTableName()
This returns the user-supplied table name of the column. |
TableName |
getTableNameObject()
|
int |
getVirtualColumnId()
Get the virtualColumnId for this ResultColumn |
void |
init(Object arg1,
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(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 |
String |
toString()
Convert this object to a String. |
| Methods inherited from class com.akiban.sql.parser.ValueNode |
|---|
getColumnName, getSourceResultColumn, getType, getTypeId, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isConstantExpression, isInListProbeNode, isParameterNode, isRelationalOperator, isSameNodeType, setNullability, setType |
| Methods inherited from class com.akiban.sql.parser.QueryTreeNode |
|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ResultColumn()
| Method Detail |
|---|
public void init(Object arg1,
Object arg2)
throws StandardException
- OR -
- OR -
- OR -
init in class QueryTreeNodeStandardException - Thrown on error
public void copyFrom(QueryTreeNode node)
throws StandardException
copyFrom in class ValueNodeStandardExceptionpublic boolean isDefaultColumn()
public void setDefaultColumn(boolean value)
public String getName()
public String getSchemaName()
throws StandardException
ValueNode
getSchemaName in class ValueNodeStandardExceptionpublic String getTableName()
ValueNode
getTableName in class ValueNodepublic int getColumnPosition()
public void setExpression(ValueNode expression)
expression - The expression to be set in this ResultColumnpublic ValueNode getExpression()
public void setName(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 String toString()
toString in class ValueNodepublic void printSubNodes(int depth)
printSubNodes in class QueryTreeNodedepth - The depth of this node in the treepublic TableName getTableNameObject()
public ColumnReference getReference()
public boolean isEquivalent(ValueNode o)
throws StandardException
ValueNodeThis 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 ValueNodeo - the node to compare this ValueNode against.
true if the two nodes are equivalent,
false otherwise.
StandardException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||