Constructor: |
public ColumnDescriptor(String columnName,
int columnPosition,
DataTypeDescriptor columnType,
DataValueDescriptor columnDefault,
DefaultInfo columnDefaultInfo,
TableDescriptor table,
UUID defaultUUID,
long autoincStart,
long autoincInc) {
this.columnName = columnName;
this.columnPosition = columnPosition;
this.columnType = columnType;
this.columnDefault = columnDefault;
this.columnDefaultInfo = columnDefaultInfo;
this.defaultUUID = defaultUUID;
if (table != null)
{
this.table = table;
this.uuid = table.getUUID();
}
assertAutoinc(autoincInc != 0,
autoincInc,
columnDefaultInfo);
this.autoincStart = autoincStart;
this.autoincValue = autoincStart;
this.autoincInc = autoincInc;
}
Constructor for a ColumnDescriptor Parameters:
columnName - The name of the column
columnPosition - The ordinal position of the column
columnType - A DataTypeDescriptor for the type of
the column
columnDefault - 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 in
defaultUUID - The UUID for the default, if any.
autoincStart - Start value for an autoincrement column.
autoincInc - Increment for autoincrement column
|
public ColumnDescriptor(String columnName,
int columnPosition,
DataTypeDescriptor columnType,
DataValueDescriptor columnDefault,
DefaultInfo columnDefaultInfo,
TableDescriptor table,
UUID defaultUUID,
long autoincStart,
long autoincInc,
long userChangedWhat) {
this(columnName, columnPosition, columnType, columnDefault,
columnDefaultInfo, table, defaultUUID, autoincStart,
autoincInc);
autoinc_create_or_modify_Start_Increment = userChangedWhat;
}
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 column
columnPosition - The ordinal position of the column
columnType - A DataTypeDescriptor for the type of
the column
columnDefault - 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 in
defaultUUID - The UUID for the default, if any.
autoincStart - Start value for an autoincrement column.
autoincInc - Increment for autoincrement column
userChangedWhat - Adding an autoincrement column OR
changing increment value or start value of
the autoincrement column.
|
public ColumnDescriptor(String columnName,
int columnPosition,
DataTypeDescriptor columnType,
DataValueDescriptor columnDefault,
DefaultInfo columnDefaultInfo,
UUID uuid,
UUID defaultUUID,
long autoincStart,
long autoincInc,
long autoincValue) {
this.columnName = columnName;
this.columnPosition = columnPosition;
this.columnType = columnType;
this.columnDefault = columnDefault;
this.columnDefaultInfo = columnDefaultInfo;
this.uuid = uuid;
this.defaultUUID = defaultUUID;
assertAutoinc(autoincInc!=0,
autoincInc,
columnDefaultInfo);
this.autoincStart = autoincStart;
this.autoincValue = autoincValue;
this.autoincInc = autoincInc;
}
Constructor for a ColumnDescriptor. Used when
columnDescriptor doesn't know/care about a table
descriptor. Parameters:
columnName - The name of the column
columnPosition - The ordinal position of the column
columnType - A DataTypeDescriptor for the type of
the column
columnDefault - 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 column
autoincValue - Current value of the autoincrement column
|
Method from org.apache.derby.iapi.sql.dictionary.ColumnDescriptor Detail: |
public long getAutoincInc() {
return autoincInc;
}
Get the Increment value given by the user for an autoincrement column |
public long getAutoincStart() {
return autoincStart;
}
Get the start value of an autoincrement column |
public long getAutoincValue() {
return autoincValue;
}
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. |
public long getAutoinc_create_or_modify_Start_Increment() {
return autoinc_create_or_modify_Start_Increment;
}
|
public String getColumnName() {
return columnName;
}
Get the name of the column. |
public DefaultDescriptor getDefaultDescriptor(DataDictionary dd) {
DefaultDescriptor defaultDescriptor = null;
if (defaultUUID != null)
{
defaultDescriptor = new DefaultDescriptor(dd, defaultUUID, uuid, columnPosition);
}
return defaultDescriptor;
}
Get a DefaultDescriptor for the default, if any, associated with this column. |
public DefaultInfo getDefaultInfo() {
return columnDefaultInfo;
}
Get the DefaultInfo for this ColumnDescriptor. |
public UUID getDefaultUUID() {
return defaultUUID;
}
Get the UUID for the column default, if any. |
public DataValueDescriptor getDefaultValue() {
return columnDefault;
}
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. |
public String getDescriptorName() {
// try and get rid of getColumnName!
return columnName;
}
|
public String getDescriptorType() {
return "Column";
}
|
public int getPosition() {
return columnPosition;
}
Get the ordinal position of the column (1 based) |
public UUID getReferencingUUID() {
return uuid;
}
Get the UUID of the object the column is a part of. |
public TableDescriptor getTableDescriptor() {
return table;
}
Get the TableDescriptor of the column's table. |
public DataTypeDescriptor getType() {
return columnType;
}
Get the TypeDescriptor of the column's datatype. |
public boolean hasGenerationClause() {
if ( columnDefaultInfo == null ) { return false; }
else { return columnDefaultInfo.isGeneratedColumn(); }
}
Is this column a generated column |
public boolean hasNonNullDefault() {
if (columnDefault != null && ! columnDefault.isNull())
{
return true;
}
return columnDefaultInfo != null;
}
Return whether or not there is a non-null default on this column. |
public boolean isAutoincAlways() {
return (columnDefaultInfo == null) && isAutoincrement();
}
Is this column to have autoincremented value always ? |
public boolean isAutoincrement() {
return (autoincInc != 0);
}
Is this column an autoincrement column? |
public void setAutoinc_create_or_modify_Start_Increment(int c_or_m) {
autoinc_create_or_modify_Start_Increment = c_or_m;
}
|
public void setColumnName(String newColumnName) {
this.columnName = newColumnName;
}
Sets the column name in case of rename column. |
public void setPosition(int columnPosition) {
this.columnPosition = columnPosition;
}
Set the ordinal position of the column. |
public void setTableDescriptor(TableDescriptor tableDescriptor) {
this.table = tableDescriptor;
}
Sets the table descriptor for the column. |
public String toString() {
if (SanityManager.DEBUG)
{
/*
** NOTE: This does not format table, because table.toString()
** formats columns, leading to infinite recursion.
*/
return "columnName: " + columnName + "\n" +
"columnPosition: " + columnPosition + "\n" +
"columnType: " + columnType + "\n" +
"columnDefault: " + columnDefault + "\n" +
"uuid: " + uuid + "\n" +
"defaultUUID: " + defaultUUID + "\n";
}
else
{
return "";
}
}
Convert the ColumnDescriptor to a String. |
public boolean updatableByCursor() {
return false;
}
|