// Clean up after the old default, if non-null
if (columnDescriptor.hasNonNullDefault())
{
// Invalidate off of the old default
DefaultDescriptor defaultDescriptor = new DefaultDescriptor(dd, columnInfo[ix].oldDefaultUUID,
td.getUUID(), columnPosition);
dm.invalidateFor(defaultDescriptor, DependencyManager.MODIFY_COLUMN_DEFAULT, lcc);
// Drop any dependencies
dm.clearDependencies(lcc, defaultDescriptor);
}
UUID defaultUUID = columnInfo[ix].newDefaultUUID;
/* Generate a UUID for the default, if one exists
* and there is no default id yet.
*/
if (columnInfo[ix].defaultInfo != null &&
defaultUUID == null)
{
defaultUUID = dd.getUUIDFactory().createUUID();
}
/* Get a ColumnDescriptor reflecting the new default */
columnDescriptor = new ColumnDescriptor(
columnInfo[ix].name,
columnPosition,
columnInfo[ix].dataType,
columnInfo[ix].defaultValue,
columnInfo[ix].defaultInfo,
td,
defaultUUID,
columnInfo[ix].autoincStart,
columnInfo[ix].autoincInc,
columnInfo[ix].autoincInc != 0
);
// Update the ColumnDescriptor with new default info
dd.dropColumnDescriptor(td.getUUID(), columnInfo[ix].name, tc);
dd.addDescriptor(columnDescriptor, td,
DataDictionary.SYSCOLUMNS_CATALOG_NUM, false, tc);
if (columnInfo[ix].autoincInc != 0)
{
// adding an autoincrement default-- calculate the maximum value
// of the autoincrement column.
long maxValue = getColumnMax(activation, td, columnInfo[ix].name,
columnInfo[ix].autoincInc,
columnInfo[ix].autoincStart);
dd.setAutoincrementValue(tc, td.getUUID(), columnInfo[ix].name,
maxValue, true);
}
// Add default info for new default, if non-null
if (columnDescriptor.hasNonNullDefault())
{
DefaultDescriptor defaultDescriptor =
new DefaultDescriptor(dd, defaultUUID,
td.getUUID(),
columnPosition);
/* Create stored dependencies for each provider to default */
ProviderInfo[] providerInfo = ((DefaultInfoImpl) columnInfo[ix].defaultInfo).getProviderInfo();