Top Description Fields Constructors Methods
org.apache.derby.impl.sql

public final Class GenericColumnDescriptor

extends Object
implements ResultColumnDescriptor, Formatable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable, org.apache.derby.iapi.sql.ResultColumnDescriptor
Imports
org.apache.derby.catalog.types.RoutineAliasInfo, org.apache.derby.iapi.sql.ResultColumnDescriptor, org.apache.derby.iapi.types.DataTypeDescriptor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.StoredFormatIds, .FormatIdUtil, .Formatable, .FormatableHashtable, .FormatableIntHolder, java.io.ObjectOutput, .ObjectInput, .IOException

This is a stripped down implementation of a column descriptor that is intended for generic use. It can be seralized and attached to plans.

Field Summary

Modifier and TypeField and Description
private int
private boolean
private boolean
private String
name

This class implements Formatable.

private String
private String
private DataTypeDescriptor
private boolean

Constructor Summary

AccessConstructor and Description
public
GenericColumnDescriptor()

Niladic constructor for Formatable

public
public
GenericColumnDescriptor(ResultColumnDescriptor
the ResultColumnDescriptor
rcd
)

This constructor is used to build a generic (and formatable) ColumnDescriptor.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

An int containing the position of the Column within the table.
getColumnPosition
()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getColumnPosition.

Get the position of the Column.

public String

Returns:

A String containing the name of the column.
getName
()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getName.

Returns the name of the Column.

public String

Returns:

A String containing the name of the schema of the Column's table. If the column is not in a schema (i.e. is a derived column), it returns NULL.
getSourceSchemaName
()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getSourceSchemaName.

Get the name of the schema for the Column's base table, if any.

public String

Returns:

A String containing the name of the Column's base table. If the column is not in a table (i.e. is a derived column), it returns NULL.
getSourceTableName
()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getSourceTableName.

Get the name of the underlying(base) table this column comes from, if any.

private DataTypeDescriptor

Returns:

DataTypeDescriptor
getStoredDataTypeDescriptor
(Object
object as obtained by fh.get("type") in readExternal
o
)

When retrieving a DataTypeDescriptor, it might just be a regular DataTypeDescriptor or may be an OldRoutineType, as used for Routine parameters and return values prior to DERBY-2775.

public DataTypeDescriptor

Returns:

A DataTypeDescriptor describing the type of the column.
getType
()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getType.

Returns a DataTypeDescriptor for the column.

public int

Returns:

the formatID of this class
getTypeFormatId
()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get the formatID which corresponds to this class.

public boolean
hasGenerationClause()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.hasGenerationClause.

Return true if this result column represents a generated column.

public boolean
isAutoincrement()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.isAutoincrement.

Tell us if the column is an autoincrement column or not.

public void
readExternal(ObjectInput
read this.
in
)

Implements java.io.Externalizable.readExternal.

Read this object from a stream of stored objects.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
updatableByCursor()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.updatableByCursor.

Return true if the column is wirtable by a positioned update.

public void
writeExternal(ObjectOutput
write bytes here
out
)

Implements java.io.Externalizable.writeExternal.

Write this object out

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

columnPosback to summary
private int columnPos
hasGenerationClauseback to summary
private boolean hasGenerationClause
isAutoincrementback to summary
private boolean isAutoincrement
nameback to summary
private String name

This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method.

schemaNameback to summary
private String schemaName
tableNameback to summary
private String tableName
typeback to summary
private DataTypeDescriptor type
updatableByCursorback to summary
private boolean updatableByCursor

Constructor Detail

GenericColumnDescriptorback to summary
public GenericColumnDescriptor()

Niladic constructor for Formatable

GenericColumnDescriptorback to summary
public GenericColumnDescriptor(String name, DataTypeDescriptor type)
GenericColumnDescriptorback to summary
public GenericColumnDescriptor(ResultColumnDescriptor rcd)

This constructor is used to build a generic (and formatable) ColumnDescriptor. The idea is that it can be passed a ColumnDescriptor from a query tree and convert it to something that can be used anywhere.

Parameters
rcd:ResultColumnDescriptor

the ResultColumnDescriptor

Method Detail

getColumnPositionback to summary
public int getColumnPosition()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getColumnPosition.

Get the position of the Column. NOTE - position is 1-based.

Returns:int

An int containing the position of the Column within the table.

getNameback to summary
public String getName()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getName.

Returns the name of the Column.

Returns:String

A String containing the name of the column.

getSourceSchemaNameback to summary
public String getSourceSchemaName()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getSourceSchemaName.

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

Returns:String

A String containing the name of the schema of the Column's table. If the column is not in a schema (i.e. is a derived column), it returns NULL.

getSourceTableNameback to summary
public String getSourceTableName()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getSourceTableName.

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

Returns:String

A String containing the name of the Column's base table. If the column is not in a table (i.e. is a derived column), it returns NULL.

getStoredDataTypeDescriptorback to summary
private DataTypeDescriptor getStoredDataTypeDescriptor(Object o)

When retrieving a DataTypeDescriptor, it might just be a regular DataTypeDescriptor or may be an OldRoutineType, as used for Routine parameters and return values prior to DERBY-2775. If it is not a regular DataTypeDescriptor, it must be an OldRoutineType, so convert it to a DataTypeDescriptor DERBY-4913

Parameters
o:Object

object as obtained by fh.get("type") in readExternal

Returns:DataTypeDescriptor

DataTypeDescriptor

getTypeback to summary
public DataTypeDescriptor getType()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.getType.

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.

Returns:DataTypeDescriptor

A DataTypeDescriptor describing the type of the column.

getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get the formatID which corresponds to this class.

Returns:int

the formatID of this class

hasGenerationClauseback to summary
public boolean hasGenerationClause()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.hasGenerationClause.

Doc from org.apache.derby.iapi.sql.ResultColumnDescriptor.hasGenerationClause.

Return true if this result column represents a generated column.

Returns:boolean

true if this result column represents a generated column

isAutoincrementback to summary
public boolean isAutoincrement()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.isAutoincrement.

Doc from org.apache.derby.iapi.sql.ResultColumnDescriptor.isAutoincrement.

Tell us if the column is an autoincrement column or not.

Returns:boolean

TRUE, if the column is a base column of a table and is an autoincrement column.

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Read this object from a stream of stored objects.

Parameters
in:ObjectInput

read this.

Exceptions
IOException:
thrown on error
ClassNotFoundException:
thrown on error
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

updatableByCursorback to summary
public boolean updatableByCursor()

Implements org.apache.derby.iapi.sql.ResultColumnDescriptor.updatableByCursor.

Doc from org.apache.derby.iapi.sql.ResultColumnDescriptor.updatableByCursor.

Return true if the column is wirtable by a positioned update.

Returns:boolean

TRUE, if the column is a base column of a table and is writable by a positioned update.

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Write this object out

Parameters
out:ObjectOutput

write bytes here

Exceptions
IOException:
thrown on error