// need to deal with triggers if has referencedColumns
GenericDescriptorList tdl = dd.getTriggerDescriptors(td);
Enumeration descs = tdl.elements();
while (descs.hasMoreElements())
{
TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
int[] referencedCols = trd.getReferencedCols();
if (referencedCols == null)
continue;
int refColLen = referencedCols.length, j;
boolean changed = false;
for (j = 0; j < refColLen; j++)
{
if (referencedCols[j] > columnPosition)
changed = true;
else if (referencedCols[j] == columnPosition)
{
if (cascade)
{
DropTriggerConstantAction.dropTriggerDescriptor(lcc, dm, dd, tc, trd, activation);
activation.addWarning(
StandardException.newWarning(SQLState.LANG_TRIGGER_DROPPED,
trd.getName(), td.getName()));
}
else
{ // we'd better give an error if don't drop it,
// otherwsie there would be unexpected behaviors
throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,
dm.getActionString(DependencyManager.DROP_COLUMN),
columnInfo[ix].name, "TRIGGER",
trd.getName() );
}
break;
}
}