org.apache.derby.impl.sql
Class GenericColumnDescriptor

java.lang.Object
  extended byorg.apache.derby.impl.sql.GenericColumnDescriptor
All Implemented Interfaces:
java.io.Externalizable, Formatable, ResultColumnDescriptor, java.io.Serializable, TypedFormat

public final class GenericColumnDescriptor
extends java.lang.Object
implements ResultColumnDescriptor, Formatable

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

Author:
jamie
See Also:
Serialized Form

Field Summary
private  int columnPos
           
private  boolean isAutoincrement
           
private  java.lang.String name
          This class implements Formatable.
private  java.lang.String schemaName
           
private  java.lang.String tableName
           
private  DataTypeDescriptor type
           
private  boolean updatableByCursor
           
 
Constructor Summary
GenericColumnDescriptor()
          Niladic constructor for Formatable
GenericColumnDescriptor(ResultColumnDescriptor rcd)
          This constructor is used to build a generic (and formatable) ColumnDescriptor.
GenericColumnDescriptor(java.lang.String name, DataTypeDescriptor type)
           
 
Method Summary
 void djdrcd()
           
 int getColumnPosition()
          Get the position of the Column.
 java.lang.String getName()
          Returns the 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.
 DataTypeDescriptor getType()
          Returns a DataTypeDescriptor for the column.
 int getTypeFormatId()
          Get the formatID which corresponds to this class.
 boolean isAutoincrement()
          Tell us if the column is an autoincrement column or not.
 void readExternal(java.io.ObjectInput in)
          Read this object from a stream of stored objects.
 java.lang.String toString()
           
 boolean updatableByCursor()
          Return true if the column is wirtable by a positioned update.
 void writeExternal(java.io.ObjectOutput out)
          Write this object out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.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.


schemaName

private java.lang.String schemaName

tableName

private java.lang.String tableName

columnPos

private int columnPos

type

private DataTypeDescriptor type

isAutoincrement

private boolean isAutoincrement

updatableByCursor

private boolean updatableByCursor
Constructor Detail

GenericColumnDescriptor

public GenericColumnDescriptor()
Niladic constructor for Formatable


GenericColumnDescriptor

public GenericColumnDescriptor(java.lang.String name,
                               DataTypeDescriptor type)

GenericColumnDescriptor

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 - the ResultColumnDescriptor
Method Detail

getType

public DataTypeDescriptor 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.

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

getName

public java.lang.String getName()
Returns the name of the Column.

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

getSourceSchemaName

public java.lang.String 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

Specified by:
getSourceSchemaName in interface ResultColumnDescriptor
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.

getSourceTableName

public java.lang.String 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

Specified by:
getSourceTableName in interface ResultColumnDescriptor
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.

getColumnPosition

public int getColumnPosition()
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.

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.

updatableByCursor

public boolean updatableByCursor()
Description copied from interface: ResultColumnDescriptor
Return true if the column is wirtable by a positioned update.

Specified by:
updatableByCursor in interface ResultColumnDescriptor
Returns:
TRUE, if the column is a base column of a table and is writable by a positioned update.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write this object out

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - write bytes here
Throws:
java.io.IOException - thrown on error

djdrcd

public void djdrcd()

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read this object from a stream of stored objects.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - read this.
Throws:
java.io.IOException - thrown on error
java.lang.ClassNotFoundException - thrown on error

getTypeFormatId

public int getTypeFormatId()
Get the formatID which corresponds to this class.

Specified by:
getTypeFormatId in interface TypedFormat
Returns:
the formatID of this class

toString

public java.lang.String toString()

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

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