trigger deleteUp
System trigger that handles deletion of Up entity occurrences. (An Up entity is an inner entity that represents the One side in a one-to-many relationship.)
Declaration: | trigger deleteUp
|
Applies to: | Up Entity |
Activation: | Activated by the erase and store ProcScript commands, for each database occurrence of an up entity that will be removed. For details, see Trigger Activation. |
Default behavior: | None |
Behavior upon completion: | None |
Description!
If an component entity is defined as an Up entity in the component structure, removing occurrences from the database is only possible if the deleteUp trigger contains a delete statement.
Caution: Placing a delete statement in the deleteUp trigger can have serious implications for database integrity.
This is not advisable unless you can be absolutely sure that there are no outer entities that use this occurrence of the Up entity, and that the information in this occurrence can be safely deleted.
Using delete in this trigger for an Up entity can cause serious problems in the store process. DBMSs that cannot handle referential integrity constraints (that is, Uniface does it for them) could delete an Up occurrence while related, orphan occurrences still exist. Uniface does not carry out the constraint check in this case, because of your code.
DBMSs which do support referential integrity constraints return store errors if they detect constraint violations which are tolerated by Uniface. This is especially likely to happen if compiling the component returns a warning message indicating that an entity needed for integrity control has not been painted.
Trigger Activation
This trigger is only activated for Up entities. For more information, see Related Component Entities.
If an entity is painted as a Down entity, the delete trigger is activated instead.
When storing data after removing occurrences, the store statement causes Uniface to activate the deleteUp trigger for every Up entity present in the component, in which one or more occurrences has been removed.
The deleteUp trigger for an inner, Up entity is also activated when an occurrence of the outer entity is removed, and the store statement is used. For more information, see $occdel.
If the deleteUp trigger of an Up entity contains ProcScript, the lock trigger of this entity is activated when the user modifies an occurrence in the Up entity. If the deleteUp trigger is empty, the lock trigger of the Up entity is not activated.
The deleteUp trigger is not fired if referential integrity is handled by the database, rather than by Uniface. For more information on how referential integrity is handled, see the connector documentation for your database.