Class ColumnDescriptor
- java.lang.Object
-
- org.apache.derby.iapi.sql.dictionary.TupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.ColumnDescriptor
-
public final class ColumnDescriptor extends TupleDescriptor
This class represents a column descriptor. public methods in this class are:- long getAutoincStart()
- java.lang.String getColumnName()
- DefaultDescriptor getDefaultDescriptor(DataDictionary dd)
- DefaultInfo getDefaultInfo
- UUID getDefaultUUID
- DataValueDescriptor getDefaultValue
- int getPosition()
- UUID getReferencingUUID()
- TableDescriptor getTableDescriptor
- DTD getType()
- hasNonNullDefault
- isAutoincrement
- setColumnName
- setPosition
-
-
Field Summary
Fields Modifier and Type Field Description (package private) longautoinc_create_or_modify_Start_Incrementprivate booleanautoincCycleprivate longautoincIncprivate longautoincStartprivate longautoincValueprivate DataValueDescriptorcolumnDefaultprivate DefaultInfocolumnDefaultInfoprivate java.lang.StringcolumnNameprivate intcolumnPositionprivate DataTypeDescriptorcolumnTypeprivate UUIDdefaultUUIDprivate TableDescriptortableprivate UUIDuuid
-
Constructor Summary
Constructors Constructor Description ColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, UUID uuid, UUID defaultUUID, long autoincStart, long autoincInc, long autoincValue, boolean autoincCycle)Constructor for a ColumnDescriptor.ColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, TableDescriptor table, UUID defaultUUID, long autoincStart, long autoincInc, boolean autoincCycle)Constructor for a ColumnDescriptorColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, TableDescriptor table, UUID defaultUUID, long autoincStart, long autoincInc, long userChangedWhat, boolean autoincCycle)Constructor for a ColumnDescriptor when the column involved is an autoincrement column.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidassertAutoinc(boolean autoinc, long autoincInc, DefaultInfo defaultInfo)longgetAutoinc_create_or_modify_Start_Increment()booleangetAutoincCycle()longgetAutoincInc()Get the Increment value given by the user for an autoincrement columnlonggetAutoincStart()Get the start value of an autoincrement columnlonggetAutoincValue()Get the current value for an autoincrement column.java.lang.StringgetColumnName()Get the name of the column.DefaultDescriptorgetDefaultDescriptor(DataDictionary dd)Get a DefaultDescriptor for the default, if any, associated with this column.DefaultInfogetDefaultInfo()Get the DefaultInfo for this ColumnDescriptor.UUIDgetDefaultUUID()Get the UUID for the column default, if any.DataValueDescriptorgetDefaultValue()Get the default value for the column.java.lang.StringgetDescriptorName()java.lang.StringgetDescriptorType()Each descriptor must identify itself with its type; i.e index, check constraint whatever.intgetPosition()Get the ordinal position of the column (1 based)UUIDgetReferencingUUID()Get the UUID of the object the column is a part of.TableDescriptorgetTableDescriptor()Get the TableDescriptor of the column's table.DataTypeDescriptorgetType()Get the TypeDescriptor of the column's datatype.booleanhasGenerationClause()Is this column a generated columnbooleanhasNonNullDefault()Return whether or not there is a non-null default on this column.booleanisAutoincAlways()Is this column to have autoincremented value always ?booleanisAutoincrement()Is this column an autoincrement column?voidsetAutoinc_create_or_modify_Start_Increment(int c_or_m)voidsetColumnName(java.lang.String newColumnName)Sets the column name in case of rename column.voidsetPosition(int columnPosition)Set the ordinal position of the column.voidsetTableDescriptor(TableDescriptor tableDescriptor)Sets the table descriptor for the column.java.lang.StringtoString()Convert the ColumnDescriptor to a String.booleanupdatableByCursor()-
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, isPersistent, setDataDictionary
-
-
-
-
Field Detail
-
columnDefaultInfo
private DefaultInfo columnDefaultInfo
-
table
private TableDescriptor table
-
columnName
private java.lang.String columnName
-
columnPosition
private int columnPosition
-
columnType
private DataTypeDescriptor columnType
-
columnDefault
private DataValueDescriptor columnDefault
-
uuid
private UUID uuid
-
defaultUUID
private UUID defaultUUID
-
autoincStart
private long autoincStart
-
autoincInc
private long autoincInc
-
autoincValue
private long autoincValue
-
autoincCycle
private boolean autoincCycle
-
autoinc_create_or_modify_Start_Increment
long autoinc_create_or_modify_Start_Increment
-
-
Constructor Detail
-
ColumnDescriptor
public ColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, TableDescriptor table, UUID defaultUUID, long autoincStart, long autoincInc, long userChangedWhat, boolean autoincCycle)Constructor for a ColumnDescriptor when the column involved is an autoincrement column. The last parameter to this method indicates if an autoincrement column is getting added or if the autoincrement column is being modified to change the increment value or to change the start value- Parameters:
columnName- The name of the columncolumnPosition- The ordinal position of the columncolumnType- A DataTypeDescriptor for the type of the columncolumnDefault- A DataValueDescriptor representing the default value of the column, if any (null if no default)columnDefaultInfo- The default info for the column.table- A TableDescriptor for the table the column is indefaultUUID- The UUID for the default, if any.autoincStart- Start value for an autoincrement column.autoincInc- Increment for autoincrement columnuserChangedWhat- Adding an autoincrement column OR changing increment value or start value of the autoincrement column.
-
ColumnDescriptor
public ColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, TableDescriptor table, UUID defaultUUID, long autoincStart, long autoincInc, boolean autoincCycle)Constructor for a ColumnDescriptor- Parameters:
columnName- The name of the columncolumnPosition- The ordinal position of the columncolumnType- A DataTypeDescriptor for the type of the columncolumnDefault- A DataValueDescriptor representing the default value of the column, if any (null if no default)columnDefaultInfo- The default info for the column.table- A TableDescriptor for the table the column is indefaultUUID- The UUID for the default, if any.autoincStart- Start value for an autoincrement column.autoincInc- Increment for autoincrement column
-
ColumnDescriptor
public ColumnDescriptor(java.lang.String columnName, int columnPosition, DataTypeDescriptor columnType, DataValueDescriptor columnDefault, DefaultInfo columnDefaultInfo, UUID uuid, UUID defaultUUID, long autoincStart, long autoincInc, long autoincValue, boolean autoincCycle)Constructor for a ColumnDescriptor. Used when columnDescriptor doesn't know/care about a table descriptor.- Parameters:
columnName- The name of the columncolumnPosition- The ordinal position of the columncolumnType- A DataTypeDescriptor for the type of the columncolumnDefault- A DataValueDescriptor representing the default value of the column, if any (null if no default)columnDefaultInfo- The default info for the column.uuid- A uuid for the object that this column is in.defaultUUID- The UUID for the default, if any.autoincStart- Start value for an autoincrement column.autoincInc- Increment for autoincrement columnautoincValue- Current value of the autoincrement column
-
-
Method Detail
-
getReferencingUUID
public UUID getReferencingUUID()
Get the UUID of the object the column is a part of.- Returns:
- The UUID of the table the column is a part of.
-
getTableDescriptor
public TableDescriptor getTableDescriptor()
Get the TableDescriptor of the column's table.- Returns:
- The TableDescriptor of the column's table.
-
getColumnName
public java.lang.String getColumnName()
Get the name of the column.- Returns:
- A String containing the name of the column.
-
setColumnName
public void setColumnName(java.lang.String newColumnName)
Sets the column name in case of rename column.- Parameters:
newColumnName- The new column name.
-
setTableDescriptor
public void setTableDescriptor(TableDescriptor tableDescriptor)
Sets the table descriptor for the column.- Parameters:
tableDescriptor- The table descriptor for this column
-
getPosition
public int getPosition()
Get the ordinal position of the column (1 based)- Returns:
- The ordinal position of the column.
-
getType
public DataTypeDescriptor getType()
Get the TypeDescriptor of the column's datatype.- Returns:
- The TypeDescriptor of the column's datatype.
-
hasNonNullDefault
public boolean hasNonNullDefault()
Return whether or not there is a non-null default on this column.- Returns:
- Whether or not there is a non-null default on this column.
-
getDefaultValue
public DataValueDescriptor getDefaultValue()
Get the default value for the column. For columns with primitive types, the object returned will be of the corresponding object type. For example, for a float column, getDefaultValue() will return a Float.- Returns:
- An object with the value and type of the default value for the column. Returns NULL if there is no default.
-
getDefaultInfo
public DefaultInfo getDefaultInfo()
Get the DefaultInfo for this ColumnDescriptor.- Returns:
- The DefaultInfo for this ColumnDescriptor.
-
getDefaultUUID
public UUID getDefaultUUID()
Get the UUID for the column default, if any.- Returns:
- The UUID for the column default, if any.
-
getDefaultDescriptor
public DefaultDescriptor getDefaultDescriptor(DataDictionary dd)
Get a DefaultDescriptor for the default, if any, associated with this column.- Parameters:
dd- The DataDictionary.- Returns:
- A DefaultDescriptor if this column has a column default.
-
isAutoincrement
public boolean isAutoincrement()
Is this column an autoincrement column?- Returns:
- Whether or not this is an autoincrement column
-
updatableByCursor
public boolean updatableByCursor()
-
hasGenerationClause
public boolean hasGenerationClause()
Is this column a generated column
-
isAutoincAlways
public boolean isAutoincAlways()
Is this column to have autoincremented value always ?
-
getAutoincStart
public long getAutoincStart()
Get the start value of an autoincrement column- Returns:
- Get the start value of an autoincrement column
-
getAutoincCycle
public boolean getAutoincCycle()
-
getAutoincInc
public long getAutoincInc()
Get the Increment value given by the user for an autoincrement column- Returns:
- the Increment value for an autoincrement column
-
getAutoincValue
public long getAutoincValue()
Get the current value for an autoincrement column. One case in which this is used involves dropping a column from a table. When ALTER TABLE DROP COLUMN runs, it drops the column from SYSCOLUMNS, and then must adjust the column positions of the other subsequent columns in the table to account for the removal of the dropped columns. This involves deleting and re-adding the column descriptors to SYSCOLUMNS, but during that process we must be careful to preserve the current value of any autoincrement column.- Returns:
- the current value for an autoincrement column
-
getAutoinc_create_or_modify_Start_Increment
public long getAutoinc_create_or_modify_Start_Increment()
-
setAutoinc_create_or_modify_Start_Increment
public void setAutoinc_create_or_modify_Start_Increment(int c_or_m)
-
setPosition
public void setPosition(int columnPosition)
Set the ordinal position of the column.
-
toString
public java.lang.String toString()
Convert the ColumnDescriptor to a String.- Overrides:
toStringin classjava.lang.Object- Returns:
- A String representation of this ColumnDescriptor
-
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorNamein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorName()
-
getDescriptorType
public java.lang.String getDescriptorType()
Description copied from class:TupleDescriptorEach descriptor must identify itself with its type; i.e index, check constraint whatever.- Overrides:
getDescriptorTypein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorType()
-
assertAutoinc
private static void assertAutoinc(boolean autoinc, long autoincInc, DefaultInfo defaultInfo)
-
-