* @exception StandardException Thrown on failure
*/
public void executeConstantAction( Activation activation )
throws StandardException
{
TriggerDescriptor triggerd;
LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
DataDictionary dd = lcc.getDataDictionary();
/*
** Inform the data dictionary that we are about to write to it.
** There are several calls to data dictionary "get" methods here
** that might be done in "read" mode in the data dictionary, but
** it seemed safer to do this whole operation in "write" mode.
**
** We tell the data dictionary we're done writing at the end of
** the transaction.
*/
dd.startWriting(lcc);
TableDescriptor td = dd.getTableDescriptor(tableId);
if (td == null)
{
throw StandardException.newException(
SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION,
tableId.toString());
}
TransactionController tc = lcc.getTransactionExecute();
lockTableForDDL(tc, td.getHeapConglomerateId(), true);
// get td again in case table shape is changed before lock is acquired
td = dd.getTableDescriptor(tableId);
if (td == null)
{
throw StandardException.newException(
SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION,
tableId.toString());
}
/*
** Get the trigger descriptor. We're responsible for raising
** the error if it isn't found
*/
triggerd = dd.getTriggerDescriptor(triggerName, sd);
if (triggerd == null)
{
throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND_DURING_EXECUTION, "TRIGGER",
(sd.getSchemaName() + "." + triggerName));
}
/*
** Prepare all dependents to invalidate. (This is there chance
** to say that they can't be invalidated. For example, an open
** cursor referencing a table/trigger that the user is attempting to
** drop.) If no one objects, then invalidate any dependent objects.
*/
triggerd.drop(lcc);
}