Whenever insert transactions have AFTER triggers closely connected to the transaction fields (e.g. a trigger that performs the file upload), the form data is first inserted into the table, and only then is the trigger executed. If the trigger fails for any reason, the data has already been inserted into the database, which may lead to corrupt or fake entries in your database.
For instance, an image file can get recorded in the database, but the actual file is not uploaded to the server, because the upload trigger failed. Consequently, the image will not be available in your application. A way to avoid this problem is implemented in MX Kollection 3, and is called a roll-back operation.
More exactly, a roll-back is an ERROR trigger that is executed when the AFTER trigger of an insert transaction has failed to execute correctly. The trigger receives the unique ID of the last inserted record. Its only function is to delete it from the database, thus providing a fail-safe mechanism against corrupted data.
As you can see in the next example, when the file upload trigger fails
because of some wrong values, the next thing to be executed is the roll-back
trigger:
