|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.ValueNode
org.apache.derby.impl.sql.compile.VirtualColumnNode
public class VirtualColumnNode
A VirtualColumnNode represents a virtual column reference to a column in a row returned by an underlying ResultSetNode. The underlying column could be in a base table, view (which could expand into a complex expression), subquery in the FROM clause, temp table, expression result, etc. By the time we get to code generation, all VirtualColumnNodes should stand only for references to columns in a base table within a FromBaseTable.
Field Summary | |
---|---|
(package private) int |
columnId
|
private boolean |
correlated
|
private ResultColumn |
sourceColumn
|
private ResultSetNode |
sourceResultSet
|
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_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Constructor Summary | |
---|---|
VirtualColumnNode()
|
Method Summary | |
---|---|
void |
generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
ColumnNode's are against the current row in the system. |
(package private) boolean |
getCorrelated()
Return whether or not this VCN is a correlated reference. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
java.lang.String |
getSchemaName()
Get the name of the schema the ResultColumn's table is in, if any. |
ResultColumn |
getSourceColumn()
Return the ResultColumn that is the source of this VirtualColumnNode. |
ResultColumn |
getSourceResultColumn()
Return the ResultColumn that is the source of this VirtualColumnNode. |
ResultSetNode |
getSourceResultSet()
Return the ResultSetNode that is the source of this VirtualColumnNode. |
java.lang.String |
getTableName()
Get the name of the table the ResultColumn is in, if any. |
DataTypeDescriptor |
getTypeServices()
Get the DataTypeServices from this Node. |
void |
init(java.lang.Object sourceResultSet,
java.lang.Object sourceColumn,
java.lang.Object columnId)
Initializer for a VirtualColumnNode. |
boolean |
isCloneable()
Return whether or not this expression tree is cloneable. |
protected boolean |
isEquivalent(ValueNode o)
Tests if this node is equivalent to the specified ValueNode. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
(package private) void |
setCorrelated()
Mark this VCN as a reference to a correlated column. |
void |
setType(DataTypeDescriptor dtd)
Set the DataTypeServices for this ValueNode. |
boolean |
updatableByCursor()
Return whether or not the ResultColumn is wirtable by a positioned update. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private ResultSetNode sourceResultSet
private ResultColumn sourceColumn
int columnId
private boolean correlated
Constructor Detail |
---|
public VirtualColumnNode()
Method Detail |
---|
public void init(java.lang.Object sourceResultSet, java.lang.Object sourceColumn, java.lang.Object columnId) throws StandardException
init
in class QueryTreeNode
sourceResultSet
- The ResultSetNode where the value is originatingsourceColumn
- The ResultColumn where the value is originatingcolumnId
- The columnId within the current Row
StandardException
- Thrown on errorpublic void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the treepublic ResultSetNode getSourceResultSet()
public ResultColumn getSourceColumn()
public java.lang.String getTableName()
getTableName
in class ValueNode
public java.lang.String getSchemaName() throws StandardException
getSchemaName
in class ValueNode
StandardException
public boolean updatableByCursor()
updatableByCursor
in class ValueNode
public ResultColumn getSourceResultColumn()
getSourceResultColumn
in class ValueNode
void setCorrelated()
boolean getCorrelated()
public boolean isCloneable()
isCloneable
in class ValueNode
public void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateExpression
in class ValueNode
acb
- The ExpressionClassBuilder for the class being builtmb
- The method the expression will go into
StandardException
- Thrown on errorprotected int getOrderableVariantType() throws StandardException
getOrderableVariantType
in class ValueNode
StandardException
- thrown on errorpublic DataTypeDescriptor getTypeServices()
getTypeServices
in class ValueNode
public void setType(DataTypeDescriptor dtd) throws StandardException
ValueNode
setType
in class ValueNode
dtd
- The DataTypeServices to set in this
ValueNode
StandardException
protected 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
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |