Package org.apache.derby.impl.sql
Class GenericColumnDescriptor
java.lang.Object
org.apache.derby.impl.sql.GenericColumnDescriptor
- All Implemented Interfaces:
Externalizable
,Serializable
,Formatable
,TypedFormat
,ResultColumnDescriptor
public final class GenericColumnDescriptor
extends 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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private boolean
private String
This class implements Formatable.private String
private String
private DataTypeDescriptor
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionNiladic constructor for FormatableGenericColumnDescriptor
(String name, DataTypeDescriptor type) This constructor is used to build a generic (and formatable) ColumnDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the position of the Column.getName()
Returns the name of the Column.Get the name of the schema for the Column's base table, if any.Get the name of the underlying(base) table this column comes from, if any.private DataTypeDescriptor
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.getType()
Returns a DataTypeDescriptor for the column.int
Get the formatID which corresponds to this class.boolean
Return true if this result column represents a generated column.boolean
Tell us if the column is an autoincrement column or not.void
Read this object from a stream of stored objects.toString()
boolean
Return true if the column is wirtable by a positioned update.void
Write this object out
-
Field Details
-
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
-
tableName
-
columnPos
private int columnPos -
type
-
isAutoincrement
private boolean isAutoincrement -
updatableByCursor
private boolean updatableByCursor -
hasGenerationClause
private boolean hasGenerationClause
-
-
Constructor Details
-
GenericColumnDescriptor
public GenericColumnDescriptor()Niladic constructor for Formatable -
GenericColumnDescriptor
-
GenericColumnDescriptor
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 Details
-
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 interfaceResultColumnDescriptor
- Returns:
- A DataTypeDescriptor describing the type of the column.
-
getName
Returns the name of the Column.- Specified by:
getName
in interfaceResultColumnDescriptor
- Returns:
- A String containing the name of the column.
-
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 interfaceResultColumnDescriptor
- 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
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 interfaceResultColumnDescriptor
- 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 interfaceResultColumnDescriptor
- 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 interfaceResultColumnDescriptor
- 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 interfaceResultColumnDescriptor
- Returns:
- TRUE, if the column is a base column of a table and is writable by a positioned update.
-
hasGenerationClause
public boolean hasGenerationClause()Description copied from interface:ResultColumnDescriptor
Return true if this result column represents a generated column.- Specified by:
hasGenerationClause
in interfaceResultColumnDescriptor
-
writeExternal
Write this object out- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- write bytes here- Throws:
IOException
- thrown on error
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
toString
-
getStoredDataTypeDescriptor
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 as obtained by fh.get("type") in readExternal- Returns:
- DataTypeDescriptor
-