it = database.schemaManager.databaseObjectIterator(
SchemaObject.TRIGGER);
while (it.hasNext()) {
TriggerDef trigger = (TriggerDef) it.next();
boolean isFullAccess =
session.getGrantee().isFullyAccessibleByRole(
trigger.getName());
if (!session.getGrantee().hasNonSelectTableRight(
trigger.getTable())) {
continue;
}
row = t.getEmptyRowData();
row[trigger_catalog] = database.getCatalogName().name;
row[trigger_schema] = trigger.getSchemaName().name;
row[trigger_name] = trigger.getName().name;
row[event_manipulation] = trigger.getEventTypeString();
row[event_object_catalog] = database.getCatalogName().name;
row[event_object_schema] = trigger.getTable().getSchemaName().name;
row[event_object_table] = trigger.getTable().getName().name;
int order =
trigger.getTable().getTriggerIndex(trigger.getName().name);
row[action_order] = ValuePool.getLong(order);
row[action_condition] = isFullAccess ? trigger.getConditionSQL()
: null;
row[action_statement] = isFullAccess ? trigger.getProcedureSQL()
: null;
row[action_orientation] = trigger.getActionOrientationString();
row[action_timing] = trigger.getActionTimingString();
row[action_reference_old_table] =
trigger.getOldTransitionTableName();
row[action_reference_new_table] =
trigger.getNewTransitionTableName();
row[action_reference_old_row] = trigger.getOldTransitionRowName();
row[action_reference_new_row] = trigger.getNewTransitionRowName();
row[created] = null;
t.insertSys(session, store, row);
}