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

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.ResultColumn
All Implemented Interfaces:
java.lang.Comparable, ResultColumnDescriptor, Visitable
Direct Known Subclasses:
AllResultColumn

public class ResultColumn
extends ValueNode
implements ResultColumnDescriptor, java.lang.Comparable

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.

Author:
Jeff Lichtman

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 org.apache.derby.impl.sql.compile.ValueNode
bindExpression, categorize, changeToCNF, checkIsBoolean, checkReliability, checkReliability, checkTopPredicatesForEqualsConditions, constantExpression, copyFields, eliminateNots, genEqualsFalseTree, generate, generateFilter, genIsNullTree, genSQLJavaSQLTree, getClause, getClone, getColumnName, getConstantValueAsObject, getDataValueFactory, getSourceResultColumn, getTablesReferenced, getTransformed, getTypeCompiler, init, isBinaryEqualsOperatorNode, isBooleanFalse, isBooleanTrue, isCloneable, isConstantExpression, isParameterNode, isRelationalOperator, optimizableEqualityNode, putAndsOnTop, remapColumnReferencesToExpressions, selectivity, setDescriptor, setTransformed, setType, verifyChangeToCNF, verifyEliminateNots, verifyPutAndsOnTop
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
bind, convertDefaultNode, 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, 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

name

java.lang.String name

exposedName

java.lang.String exposedName

tableName

java.lang.String tableName

sourceTableName

java.lang.String sourceTableName

sourceSchemaName

java.lang.String sourceSchemaName

expression

ValueNode expression

columnDescriptor

ColumnDescriptor columnDescriptor

isGenerated

boolean isGenerated

isGeneratedForUnmatchedColumnInInsert

boolean isGeneratedForUnmatchedColumnInInsert

isGroupingColumn

boolean isGroupingColumn

isReferenced

boolean isReferenced

isRedundant

boolean isRedundant

isNameGenerated

boolean isNameGenerated

updated

boolean updated

updatableByCursor

boolean updatableByCursor

defaultColumn

private boolean defaultColumn

autoincrementGenerated

boolean autoincrementGenerated

autoincrement

boolean autoincrement

resultSetNumber

private int resultSetNumber

reference

ColumnReference reference

virtualColumnId

private int virtualColumnId
Constructor Detail

ResultColumn

public ResultColumn()
Method Detail

init

public void init(java.lang.Object arg1,
                 java.lang.Object arg2)
Different types of initializer parameters indicate different types of initialization.

Overrides:
init in class QueryTreeNode
Parameters:
arg1 - The name of the column, if any.
arg2 - The expression this result column represents - OR -
Returns:
The newly initialized ResultColumn

isDefaultColumn

public boolean isDefaultColumn()
Returns TRUE if the ResultColumn is standing in for a DEFAULT keyword in an insert/update statement.


setDefaultColumn

public void setDefaultColumn(boolean value)

getName

public java.lang.String getName()
The following methods implement the ResultColumnDescriptor interface. See the Language Module Interface for details.

Specified by:
getName in interface ResultColumnDescriptor
Returns:
A String containing the name of the column.

getSchemaName

public java.lang.String getSchemaName()
                               throws StandardException
Description copied from class: ValueNode
This returns the user-supplied schema name of the column. At this class level, it simply returns null. But, the subclasses of ValueNode will overwrite this method to return the user-supplied schema name. When the value node is in a result column of a select list, the user can request metadata information. The result column won't have a column descriptor, so we return some default information through the expression. This lets expressions that are simply columns return all of the info, and others use this supertype's default values.

Overrides:
getSchemaName in class ValueNode
Returns:
the default schema name for an expression -- null
Throws:
StandardException

getTableName

public java.lang.String getTableName()
Description copied from class: ValueNode
This returns the user-supplied table name of the column. At this class level, it simply returns null. But, the subclasses of ValueNode will overwrite this method to return the user-supplied table name. When the value node is in a result column of a select list, the user can request metadata information. The result column won't have a column descriptor, so we return some default information through the expression. This lets expressions that are simply columns return all of the info, and others use this supertype's default values.

Overrides:
getTableName in class ValueNode
Returns:
the default table name for an expression -- null

getSourceTableName

public java.lang.String getSourceTableName()
Description copied from interface: ResultColumnDescriptor
Get the name of the underlying(base) table this column comes from, if any. Following example queries will all return T select a from t select b.a from t as b select t.a from t

Specified by:
getSourceTableName in interface ResultColumnDescriptor
Returns:
A String containing the name of the base table of the Column is in. If the column is not in a table (i.e. is a derived column), it returns NULL.
See Also:
ResultColumnDescriptor.getSourceTableName()

getSourceSchemaName

public java.lang.String getSourceSchemaName()
Description copied from interface: ResultColumnDescriptor
Get the name of the schema for the Column's base table, if any. Following example queries will all return APP (assuming user is in schema APP) select t.a from t select b.a from t as b select app.t.a from t

Specified by:
getSourceSchemaName in interface ResultColumnDescriptor
Returns:
The name of the schema of the Column's base table. If the column is not in a schema (i.e. is a derived column), it returns NULL.
See Also:
ResultColumnDescriptor.getSourceSchemaName()

clearTableName

public void clearTableName()
Clear the table name for the underlying ColumnReference. See UpdateNode for full explaination.


getType

public DataTypeDescriptor getType()
Description copied from interface: ResultColumnDescriptor
Returns a DataTypeDescriptor for the column. This DataTypeDescriptor will not represent an actual value, it will only represent the type that all values in the column will have.

Specified by:
getType in interface ResultColumnDescriptor
Returns:
A DataTypeDescriptor describing the type of the column.

getExpressionType

public DataTypeDescriptor getExpressionType()

getColumnPosition

public int getColumnPosition()
Description copied from interface: ResultColumnDescriptor
Get the position of the Column. NOTE - position is 1-based.

Specified by:
getColumnPosition in interface ResultColumnDescriptor
Returns:
An int containing the position of the Column within the table.

setExpression

public void setExpression(ValueNode expression)
Set the expression in this ResultColumn. This is useful in those cases where you don't know the expression in advance, like for INSERT statements with column lists, where the column list and SELECT or VALUES clause are parsed separately, and then have to be hooked up.

Parameters:
expression - The expression to be set in this ResultColumn
Returns:
Nothing

getExpression

public ValueNode getExpression()
Get the expression in this ResultColumn.

Returns:
ValueNode this.expression

setExpressionToNullNode

void setExpressionToNullNode()
                       throws StandardException
Set the expression to a null node of the correct type.

Returns:
Nothing.
Throws:
StandardException - Thrown on error

setName

public void setName(java.lang.String name)
Set the name in this ResultColumn. This is useful when you don't know the name at the time you create the ResultColumn, for example, in an insert-select statement, where you want the names of the result columns to match the table being inserted into, not the table they came from.

Parameters:
name - The name to set in this ResultColumn
Returns:
Nothing

isNameGenerated

public boolean isNameGenerated()
Is the name for this ResultColumn generated?


setNameGenerated

public void setNameGenerated(boolean value)
Set that this result column name is generated.


setResultSetNumber

public void setResultSetNumber(int resultSetNumber)
Set the resultSetNumber for this ResultColumn. This is the resultSetNumber for the ResultSet that we belong to. This is useful for generate() and necessary since we do not have a back pointer to the RSN.

Parameters:
resultSetNumber - The resultSetNumber.
Returns:
Nothing.

getResultSetNumber

public int getResultSetNumber()
Get the resultSetNumber for this ResultColumn.

Returns:
int The resultSetNumber.

setClause

public void setClause(int clause)
Set the clause that this node appears in.

Overrides:
setClause in class ValueNode
Parameters:
clause - The clause that this node appears in.
Returns:
Nothing.

adjustVirtualColumnId

public void adjustVirtualColumnId(int adjust)
Adjust the virtualColumnId for this ResultColumn by the specified amount

Parameters:
adjust - The adjustment for the virtualColumnId
Returns:
Nothing

setVirtualColumnId

public void setVirtualColumnId(int id)
Set the virtualColumnId for this ResultColumn

Parameters:
id - The virtualColumnId for this ResultColumn
Returns:
Nothing

getVirtualColumnId

public int getVirtualColumnId()
Get the virtualColumnId for this ResultColumn

Returns:
virtualColumnId for this ResultColumn

guaranteeColumnName

public void guaranteeColumnName()
                         throws StandardException
Generate a unique (across the entire statement) column name for unnamed ResultColumns

Returns:
None.
Throws:
StandardException - Thrown on error

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

printSubNodes

public void printSubNodes(int depth)
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work.

Overrides:
printSubNodes in class QueryTreeNode
Parameters:
depth - The depth of this node in the tree
Returns:
Nothing

bindExpression

public ValueNode bindExpression(FromList fromList,
                                SubqueryList subqueryList,
                                java.util.Vector aggregateVector)
                         throws StandardException
Bind this expression. This means binding the sub-expressions. In this case, we figure out what the result type of this result column is when we call one of the bindResultColumn*() methods. The reason is that there are different ways of binding the result columns depending on the statement type, and this is a standard interface that does not take the statement type as a parameter.

Overrides:
bindExpression in class ValueNode
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.
Throws:
StandardException - Thrown on error

bindResultColumnByPosition

void bindResultColumnByPosition(TableDescriptor tableDescriptor,
                                int columnId)
                          throws StandardException
Bind this result column by ordinal position and set the VirtualColumnId. This is useful for INSERT statements like "insert into t values (1, 2, 3)", where the user did not specify a column list. If a columnDescriptor is not found for a given position, then the user has specified more values than the # of columns in the table and an exception is thrown. NOTE: We must set the VirtualColumnId here because INSERT does not construct the ResultColumnList in the usual way.

Parameters:
tableDescriptor - The descriptor for the table being inserted into
columnId - The ordinal position of the column in the table, starting at 1.
Returns:
Nothing
Throws:
StandardException - Thrown on error

bindResultColumnByName

public void bindResultColumnByName(TableDescriptor tableDescriptor,
                                   int columnId)
                            throws StandardException
Bind this result column by its name and set the VirtualColumnId. This is useful for update statements, and for INSERT statements like "insert into t (a, b, c) values (1, 2, 3)" where the user specified a column list. An exception is thrown when a columnDescriptor cannot be found for a given name. (There is no column with that name.) NOTE: We must set the VirtualColumnId here because INSERT does not construct the ResultColumnList in the usual way.

Parameters:
tableDescriptor - The descriptor for the table being updated or inserted into
columnId - The ordinal position of the column in the table, starting at 1. (Used to set the VirtualColumnId.)
Returns:
Nothing
Throws:
StandardException - Thrown on error

typeUntypedNullExpression

public void typeUntypedNullExpression(ResultColumn bindingRC)
                               throws StandardException
Change an untyped null to a typed null.

Returns:
Nothing.
Throws:
StandardException - Thrown on error

setColumnDescriptor

void setColumnDescriptor(TableDescriptor tableDescriptor,
                         ColumnDescriptor columnDescriptor)
                   throws StandardException
Set the column descriptor for this result column. It also gets the data type services from the column descriptor and stores it in this result column: this is redundant, but we have to store the result type here for SELECT statements, and it is more orthogonal if the type can be found here regardless of what type of statement it is.

Parameters:
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.
Returns:
Nothing
Throws:
StandardException - tableNameMismatch

bindResultColumnToExpression

public void bindResultColumnToExpression()
                                  throws StandardException
Bind the result column to the expression that lives under it. All this does is copy the datatype information to this node. This is useful for SELECT statements, where the result type of each column is the type of the column's expression.

Returns:
Nothing
Throws:
StandardException - Thrown on error

preprocess

public ValueNode preprocess(int numTables,
                            FromList outerFromList,
                            SubqueryList outerSubqueryList,
                            PredicateList outerPredicateList)
                     throws StandardException
Preprocess an expression tree. We do a number of transformations here (including subqueries, IN lists, LIKE and BETWEEN) plus subquery flattening. NOTE: This is done before the outer ResultSetNode is preprocessed.

Overrides:
preprocess in class ValueNode
Parameters:
numTables - Number of tables in the DML Statement
outerFromList - FromList from outer query block
outerSubqueryList - SubqueryList from outer query block
outerPredicateList - PredicateList from outer query block
Returns:
The modified expression
Throws:
StandardException - Thrown on error

checkStorableExpression

public void checkStorableExpression(ResultColumn toStore)
                             throws StandardException
This verifies that the expression is storable into the result column. It checks versus the given ResultColumn. This method should not be called until the result column and expression both have a valid type, i.e. after they are bound appropriately. Its use is for statements like insert, that need to verify if a given value can be stored into a column.

Throws:
StandardException - thrown if types not suitable.

checkStorableExpression

public void checkStorableExpression()
                             throws StandardException
This verifies that the expression is storable into the result column. It checks versus the expression under this ResultColumn. This method should not be called until the result column and expression both have a valid type, i.e. after they are bound appropriately. Its use is for statements like update, that need to verify if a given value can be stored into a column.

Throws:
StandardException - thrown if types not suitable.

generateExpression

public void generateExpression(ExpressionClassBuilder ecb,
                               MethodBuilder mb)
                        throws StandardException
Do code generation for a result column. This consists of doing the code generation for the underlying expression.

Overrides:
generateExpression in class ValueNode
Parameters:
ecb - The ExpressionClassBuilder for the class we're generating
mb - The method the expression will go into
Throws:
StandardException - Thrown on error

generateHolder

public void generateHolder(ExpressionClassBuilder acb,
                           MethodBuilder mb)
                    throws StandardException
Generate the code to create a column the same shape and size as this ResultColumn. Used in ResultColumnList.generateHolder().

Throws:
StandardException - thrown on failure

columnTypeAndLengthMatch

boolean columnTypeAndLengthMatch()
                           throws StandardException
Throws:
StandardException

columnTypeAndLengthMatch

boolean columnTypeAndLengthMatch(ResultColumn otherColumn)
                           throws StandardException
Throws:
StandardException

isGenerated

public boolean isGenerated()
Is this a generated column?

Returns:
Boolean - whether or not this column is a generated column.

isGeneratedForUnmatchedColumnInInsert

public boolean isGeneratedForUnmatchedColumnInInsert()
Is this columm generated for an unmatched column in an insert?

Returns:
Boolean - whether or not this columm was generated for an unmatched column in an insert.

markGenerated

public void markGenerated()
Mark this a columm as a generated column

Returns:
None.

markGeneratedForUnmatchedColumnInInsert

public void markGeneratedForUnmatchedColumnInInsert()
Mark this a columm as generated for an unmatched column in an insert

Returns:
None.

isReferenced

public boolean isReferenced()
Is this a referenced column?

Returns:
Boolean - whether or not this column is a referenced column.

setReferenced

public void setReferenced()
Mark this column as a referenced column.

Returns:
None.

pullVirtualIsReferenced

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.


setUnreferenced

public void setUnreferenced()
Mark this column as an unreferenced column.

Returns:
None.

markAllRCsInChainReferenced

void markAllRCsInChainReferenced()
Mark this RC and all RCs in the underlying RC/VCN chain as referenced.

Returns:
Nothing.

isRedundant

public boolean isRedundant()
Is this a redundant ResultColumn?

Returns:
Boolean - whether or not this RC is redundant.

setRedundant

public void setRedundant()
Mark this ResultColumn as redundant.

Returns:
None.

markAsGroupingColumn

public void markAsGroupingColumn()
Mark this ResultColumn as a grouping column in the SELECT list

Returns:
Nothing.

rejectParameter

void rejectParameter()
               throws StandardException
Look for and reject ? parameter under this ResultColumn. This is called for SELECT statements.

Returns:
Nothing
Throws:
StandardException - Thrown if a ? parameter was found directly under this ResultColumn.

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

markUpdated

void markUpdated()
Mark this column as being updated by an update statemment.


markUpdatableByCursor

void markUpdatableByCursor()
Mark this column as being updatable, so we can make sure it is in the "for update" list of a positioned update.


updated

boolean updated()
Tell whether this column is being updated.

Returns:
true means this column is being updated.

updatableByCursor

public boolean updatableByCursor()
Tell whether this column is updatable by a positioned update.

Specified by:
updatableByCursor in interface ResultColumnDescriptor
Overrides:
updatableByCursor in class ValueNode
Returns:
true means this column is updatable

cloneMe

ResultColumn cloneMe()
               throws StandardException
Make a copy of this ResultColumn in a new ResultColumn

Returns:
A new ResultColumn with the same contents as this one
Throws:
StandardException - Thrown on error

getMaximumColumnSize

public int getMaximumColumnSize()
Get the maximum size of the column

Returns:
the max size

getOrderableVariantType

protected int getOrderableVariantType()
                               throws StandardException
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 CONSTANT - constant

Overrides:
getOrderableVariantType in class ValueNode
Returns:
The variant type for the underlying expression.
Throws:
StandardException - thrown on error

accept

public Visitable accept(Visitor v)
                 throws StandardException
Accept a visitor, and call v.visit() on child nodes as necessary.

Specified by:
accept in interface Visitable
Overrides:
accept in class QueryTreeNode
Parameters:
v - the visitor
Throws:
StandardException - on error

setNullability

public void setNullability(boolean nullability)
Set the nullability of this ResultColumn.


foundInList

public boolean foundInList(java.lang.String[] list)
Is this column in this array of strings?

Parameters:
list - the array of column names to compare
Returns:
true/false

verifyOrderable

void verifyOrderable()
               throws StandardException
Verify that this RC is orderable.

Returns:
Nothing.
Throws:
StandardException - Thrown on error

getTableColumnDescriptor

ColumnDescriptor getTableColumnDescriptor()
If this ResultColumn is bound to a column in a table get the column descriptor for the column in the table. Otherwise return null.


isAutoincrementGenerated

public boolean isAutoincrementGenerated()
Returns true if this result column is a placeholder for a generated autoincrement value.


setAutoincrementGenerated

public void setAutoincrementGenerated()

resetAutoincrementGenerated

public void resetAutoincrementGenerated()

isAutoincrement

public boolean isAutoincrement()
Description copied from interface: ResultColumnDescriptor
Tell us if the column is an autoincrement column or not.

Specified by:
isAutoincrement in interface ResultColumnDescriptor
Returns:
TRUE, if the column is a base column of a table and is an autoincrement column.

setAutoincrement

public void setAutoincrement()

convertConstant

private DataValueDescriptor convertConstant(TypeId toTypeId,
                                            int maxWidth,
                                            DataValueDescriptor constantValue)
                                     throws StandardException
Throws:
StandardException - Thrown on error

getTypeId

public TypeId getTypeId()
Get the TypeId from this Node.

Overrides:
getTypeId in class ValueNode
Returns:
The TypeId from this Node. This may be null if the node isn't bound yet.

getTypeServices

public DataTypeDescriptor getTypeServices()
Get the DataTypeServices from this Node.

Overrides:
getTypeServices in class ValueNode
Returns:
The DataTypeServices from this Node. This may be null if the node isn't bound yet.

getTableNameObject

public TableName getTableNameObject()

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

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