|
||||||||||
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.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.
Field Summary | |
(package private) boolean |
autoincrement
|
(package private) boolean |
autoincrementGenerated
|
(package private) ColumnDescriptor |
columnDescriptor
|
private boolean |
defaultColumn
|
(package private) java.lang.String |
exposedName
|
(package private) ValueNode |
expression
|
(package private) boolean |
isGenerated
|
(package private) boolean |
isGeneratedForUnmatchedColumnInInsert
|
(package private) boolean |
isGroupingColumn
|
(package private) boolean |
isNameGenerated
|
(package private) boolean |
isRedundant
|
(package private) boolean |
isReferenced
|
(package private) java.lang.String |
name
|
(package private) ColumnReference |
reference
|
private int |
resultSetNumber
|
(package private) java.lang.String |
sourceSchemaName
|
(package private) java.lang.String |
sourceTableName
|
(package private) java.lang.String |
tableName
|
(package private) boolean |
updatableByCursor
|
(package private) boolean |
updated
|
private int |
virtualColumnId
|
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 | |
ResultColumn()
|
Method Summary | |
Visitable |
accept(Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
void |
adjustVirtualColumnId(int adjust)
Adjust the virtualColumnId for this ResultColumn by the specified amount |
ValueNode |
bindExpression(FromList fromList,
SubqueryList subqueryList,
java.util.Vector aggregateVector)
Bind this expression. |
void |
bindResultColumnByName(TableDescriptor tableDescriptor,
int columnId)
Bind this result column by its name and set the VirtualColumnId. |
(package private) void |
bindResultColumnByPosition(TableDescriptor tableDescriptor,
int columnId)
Bind this result column by ordinal position and set the VirtualColumnId. |
void |
bindResultColumnToExpression()
Bind the result column to the expression that lives under it. |
void |
checkStorableExpression()
This verifies that the expression is storable into the result column. |
void |
checkStorableExpression(ResultColumn toStore)
This verifies that the expression is storable into the result column. |
void |
clearTableName()
Clear the table name for the underlying ColumnReference. |
(package private) ResultColumn |
cloneMe()
Make a copy of this ResultColumn in a new ResultColumn |
(package private) boolean |
columnTypeAndLengthMatch()
|
(package private) boolean |
columnTypeAndLengthMatch(ResultColumn otherColumn)
|
int |
compareTo(java.lang.Object other)
|
private DataValueDescriptor |
convertConstant(TypeId toTypeId,
int maxWidth,
DataValueDescriptor constantValue)
|
boolean |
foundInList(java.lang.String[] list)
Is this column in this array of strings? |
void |
generateExpression(ExpressionClassBuilder ecb,
MethodBuilder mb)
Do code generation for a result column. |
void |
generateHolder(ExpressionClassBuilder acb,
MethodBuilder mb)
Generate the code to create a column the same shape and size as this ResultColumn. |
int |
getColumnPosition()
Get the position of the Column. |
ValueNode |
getExpression()
Get the expression in this ResultColumn. |
DataTypeDescriptor |
getExpressionType()
|
int |
getMaximumColumnSize()
Get the maximum size of the column |
java.lang.String |
getName()
The following methods implement the ResultColumnDescriptor interface. |
protected int |
getOrderableVariantType()
Return the variant type for the underlying expression. |
int |
getResultSetNumber()
Get the resultSetNumber for this ResultColumn. |
java.lang.String |
getSchemaName()
This returns the user-supplied schema name of the column. |
java.lang.String |
getSourceSchemaName()
Get the name of the schema for the Column's base table, if any. |
java.lang.String |
getSourceTableName()
Get the name of the underlying(base) table this column comes from, if any. |
(package private) ColumnDescriptor |
getTableColumnDescriptor()
If this ResultColumn is bound to a column in a table get the column descriptor for the column in the table. |
java.lang.String |
getTableName()
This returns the user-supplied table name of the column. |
TableName |
getTableNameObject()
|
DataTypeDescriptor |
getType()
Returns a DataTypeDescriptor for the column. |
TypeId |
getTypeId()
Get the TypeId from this Node. |
DataTypeDescriptor |
getTypeServices()
Get the DataTypeServices from this Node. |
int |
getVirtualColumnId()
Get the virtualColumnId for this ResultColumn |
void |
guaranteeColumnName()
Generate a unique (across the entire statement) column name for unnamed ResultColumns |
void |
init(java.lang.Object arg1,
java.lang.Object arg2)
Different types of initializer parameters indicate different types of initialization. |
boolean |
isAutoincrement()
Tell us if the column is an autoincrement column or not. |
boolean |
isAutoincrementGenerated()
Returns true if this result column is a placeholder for a generated autoincrement value. |
boolean |
isDefaultColumn()
Returns TRUE if the ResultColumn is standing in for a DEFAULT keyword in an insert/update statement. |
boolean |
isGenerated()
Is this a generated column? |
boolean |
isGeneratedForUnmatchedColumnInInsert()
Is this columm generated for an unmatched column in an insert? |
boolean |
isNameGenerated()
Is the name for this ResultColumn generated? |
boolean |
isRedundant()
Is this a redundant ResultColumn? |
boolean |
isReferenced()
Is this a referenced column? |
(package private) void |
markAllRCsInChainReferenced()
Mark this RC and all RCs in the underlying RC/VCN chain as referenced. |
void |
markAsGroupingColumn()
Mark this ResultColumn as a grouping column in the SELECT list |
void |
markGenerated()
Mark this a columm as a generated column |
void |
markGeneratedForUnmatchedColumnInInsert()
Mark this a columm as generated for an unmatched column in an insert |
(package private) void |
markUpdatableByCursor()
Mark this column as being updatable, so we can make sure it is in the "for update" list of a positioned update. |
(package private) void |
markUpdated()
Mark this column as being updated by an update statemment. |
ValueNode |
preprocess(int numTables,
FromList outerFromList,
SubqueryList outerSubqueryList,
PredicateList outerPredicateList)
Preprocess an expression tree. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
(package private) void |
pullVirtualIsReferenced()
Mark this column as a referenced column if it is already marked as referenced or if any result column in its chain of virtual columns is marked as referenced. |
(package private) void |
rejectParameter()
Look for and reject ? |
void |
resetAutoincrementGenerated()
|
void |
setAutoincrement()
|
void |
setAutoincrementGenerated()
|
void |
setClause(int clause)
Set the clause that this node appears in. |
(package private) void |
setColumnDescriptor(TableDescriptor tableDescriptor,
ColumnDescriptor columnDescriptor)
Set the column descriptor for this result column. |
void |
setDefaultColumn(boolean value)
|
void |
setExpression(ValueNode expression)
Set the expression in this ResultColumn. |
(package private) void |
setExpressionToNullNode()
Set the expression to a null node of the correct type. |
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 |
setNullability(boolean nullability)
Set the nullability of this ResultColumn. |
void |
setRedundant()
Mark this ResultColumn as redundant. |
void |
setReferenced()
Mark this column as a referenced column. |
void |
setResultSetNumber(int resultSetNumber)
Set the resultSetNumber for this ResultColumn. |
void |
setUnreferenced()
Mark this column as an unreferenced column. |
void |
setVirtualColumnId(int id)
Set the virtualColumnId for this ResultColumn |
java.lang.String |
toString()
Convert this object to a String. |
void |
typeUntypedNullExpression(ResultColumn bindingRC)
Change an untyped null to a typed null. |
boolean |
updatableByCursor()
Tell whether this column is updatable by a positioned update. |
(package private) boolean |
updated()
Tell whether this column is being updated. |
(package private) void |
verifyOrderable()
Verify that this RC is orderable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
java.lang.String name
java.lang.String exposedName
java.lang.String tableName
java.lang.String sourceTableName
java.lang.String sourceSchemaName
ValueNode expression
ColumnDescriptor columnDescriptor
boolean isGenerated
boolean isGeneratedForUnmatchedColumnInInsert
boolean isGroupingColumn
boolean isReferenced
boolean isRedundant
boolean isNameGenerated
boolean updated
boolean updatableByCursor
private boolean defaultColumn
boolean autoincrementGenerated
boolean autoincrement
private int resultSetNumber
ColumnReference reference
private int virtualColumnId
Constructor Detail |
public ResultColumn()
Method Detail |
public void init(java.lang.Object arg1, java.lang.Object arg2)
init
in class QueryTreeNode
arg1
- The name of the column, if any.arg2
- The expression this result column represents
- OR -
public boolean isDefaultColumn()
public void setDefaultColumn(boolean value)
public java.lang.String getName()
getName
in interface ResultColumnDescriptor
public java.lang.String getSchemaName() throws StandardException
ValueNode
getSchemaName
in class ValueNode
StandardException
public java.lang.String getTableName()
ValueNode
getTableName
in class ValueNode
public java.lang.String getSourceTableName()
ResultColumnDescriptor
getSourceTableName
in interface ResultColumnDescriptor
ResultColumnDescriptor.getSourceTableName()
public java.lang.String getSourceSchemaName()
ResultColumnDescriptor
getSourceSchemaName
in interface ResultColumnDescriptor
ResultColumnDescriptor.getSourceSchemaName()
public void clearTableName()
public DataTypeDescriptor getType()
ResultColumnDescriptor
getType
in interface ResultColumnDescriptor
public DataTypeDescriptor getExpressionType()
public int getColumnPosition()
ResultColumnDescriptor
getColumnPosition
in interface ResultColumnDescriptor
public void setExpression(ValueNode expression)
expression
- The expression to be set in this ResultColumn
public ValueNode getExpression()
void setExpressionToNullNode() throws StandardException
StandardException
- Thrown on errorpublic void setName(java.lang.String name)
name
- The name to set in this ResultColumn
public boolean isNameGenerated()
public void setNameGenerated(boolean value)
public void setResultSetNumber(int resultSetNumber)
resultSetNumber
- The resultSetNumber.
public int getResultSetNumber()
public void setClause(int clause)
setClause
in class ValueNode
clause
- The clause that this node appears in.
public void adjustVirtualColumnId(int adjust)
adjust
- The adjustment for the virtualColumnId
public void setVirtualColumnId(int id)
id
- The virtualColumnId for this ResultColumn
public int getVirtualColumnId()
public void guaranteeColumnName() throws StandardException
StandardException
- Thrown on errorpublic java.lang.String toString()
toString
in class ValueNode
public void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the tree
public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector) throws StandardException
bindExpression
in class ValueNode
fromList
- The FROM list for the query this
expression is in, for binding columns.subqueryList
- The subquery list being built as we find SubqueryNodesaggregateVector
- The aggregate vector being built as we find AggregateNodes
StandardException
- Thrown on errorvoid bindResultColumnByPosition(TableDescriptor tableDescriptor, int columnId) throws StandardException
tableDescriptor
- The descriptor for the table being
inserted intocolumnId
- The ordinal position of the column
in the table, starting at 1.
StandardException
- Thrown on errorpublic void bindResultColumnByName(TableDescriptor tableDescriptor, int columnId) throws StandardException
tableDescriptor
- The descriptor for the table being
updated or inserted intocolumnId
- The ordinal position of the column
in the table, starting at 1. (Used to
set the VirtualColumnId.)
StandardException
- Thrown on errorpublic void typeUntypedNullExpression(ResultColumn bindingRC) throws StandardException
StandardException
- Thrown on errorvoid setColumnDescriptor(TableDescriptor tableDescriptor, ColumnDescriptor columnDescriptor) throws StandardException
tableDescriptor
- The TableDescriptor for the table
being updated or inserted into.
This parameter is used only for
error reporting.columnDescriptor
- The ColumnDescriptor to set in
this ResultColumn.
StandardException
- tableNameMismatchpublic void bindResultColumnToExpression() throws StandardException
StandardException
- Thrown on errorpublic ValueNode preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList) throws StandardException
preprocess
in class ValueNode
numTables
- Number of tables in the DML StatementouterFromList
- FromList from outer query blockouterSubqueryList
- SubqueryList from outer query blockouterPredicateList
- PredicateList from outer query block
StandardException
- Thrown on errorpublic void checkStorableExpression(ResultColumn toStore) throws StandardException
StandardException
- thrown if types not suitable.public void checkStorableExpression() throws StandardException
StandardException
- thrown if types not suitable.public void generateExpression(ExpressionClassBuilder ecb, MethodBuilder mb) throws StandardException
generateExpression
in class ValueNode
ecb
- The ExpressionClassBuilder for the class we're generatingmb
- The method the expression will go into
StandardException
- Thrown on errorpublic void generateHolder(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
StandardException
- thrown on failureboolean columnTypeAndLengthMatch() throws StandardException
StandardException
boolean columnTypeAndLengthMatch(ResultColumn otherColumn) throws StandardException
StandardException
public boolean isGenerated()
public boolean isGeneratedForUnmatchedColumnInInsert()
public void markGenerated()
public void markGeneratedForUnmatchedColumnInInsert()
public boolean isReferenced()
public void setReferenced()
void pullVirtualIsReferenced()
public void setUnreferenced()
void markAllRCsInChainReferenced()
public boolean isRedundant()
public void setRedundant()
public void markAsGroupingColumn()
void rejectParameter() throws StandardException
StandardException
- Thrown if a ? parameter was found
directly under this ResultColumn.public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
void markUpdated()
void markUpdatableByCursor()
boolean updated()
public boolean updatableByCursor()
updatableByCursor
in interface ResultColumnDescriptor
updatableByCursor
in class ValueNode
ResultColumn cloneMe() throws StandardException
StandardException
- Thrown on errorpublic int getMaximumColumnSize()
protected int getOrderableVariantType() throws StandardException
getOrderableVariantType
in class ValueNode
StandardException
- thrown on errorpublic Visitable accept(Visitor v) throws StandardException
accept
in interface Visitable
accept
in class QueryTreeNode
v
- the visitor
StandardException
- on errorpublic void setNullability(boolean nullability)
public boolean foundInList(java.lang.String[] list)
list
- the array of column names to compare
void verifyOrderable() throws StandardException
StandardException
- Thrown on errorColumnDescriptor getTableColumnDescriptor()
public boolean isAutoincrementGenerated()
public void setAutoincrementGenerated()
public void resetAutoincrementGenerated()
public boolean isAutoincrement()
ResultColumnDescriptor
isAutoincrement
in interface ResultColumnDescriptor
public void setAutoincrement()
private DataValueDescriptor convertConstant(TypeId toTypeId, int maxWidth, DataValueDescriptor constantValue) throws StandardException
StandardException
- Thrown on errorpublic TypeId getTypeId()
getTypeId
in class ValueNode
public DataTypeDescriptor getTypeServices()
getTypeServices
in class ValueNode
public TableName getTableNameObject()
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |