The DATABASE EXCEPTION statement specifies what action to take if a database-related problem occurs, as opposed to logical exceptions.
The following list details the DATABASE EXCEPTION statements:
You must add the DATABASE EXCEPTION statements to the entity action statements. Do not use these statements unless you need to specify your own logic for handling these errors. CA Gen generates code to handle these conditions for you. It rolls back any database updates that occur up to that point; for timeouts and deadlocks, CA Gen may attempt to retry the transaction automatically. Otherwise, a fatal error occurs causing the application to terminate.
Add the DATABASE EXCEPTION statements if you need changes to CA Gen's default error-handling procedures.
Important! You are responsible for database integrity after you include database exception conditions. This includes any rollback that must be done.
Rollbacks will not occur unless you use one of the following clauses:
Otherwise, any successful database updates that occur before or after the database exception are committed.
The CA Gen code generators provide default actions for the two database exception statements—WHEN DATABASE DEADLOCK or TIMEOUT and WHEN DATABASE ERROR. When a database deadlock or timeout exception is added, the generators automatically add the RETRY TRANSACTION statement. When a database error statement is added, the generators automatically add the ABORT TRANSACTION statement. These defaults cause the Action Diagram to execute in basically the same way as it would have if the database exceptions had not been added.
You must add your own error-handling statements underneath the appropriate WHEN statement to change this default behavior. You can also delete or change the RETRY and ABORT statements that are added automatically.
Unlike ordinary logical exceptions, such as WHEN not found, a database exception must have at least one action specified for it. Otherwise, the default error-handling procedures are followed for that condition, and the statement is marked as inactive.
Note: If the WHEN DATABASE DEADLOCK or TIMEOUT statement is deleted, but the WHEN DATABASE ERROR statement remains, then deadlocks or timeouts that occur during execution are captured by the WHEN DATABASE ERROR condition and follow that path.
|
Copyright © 2014 CA.
All rights reserved.
|
|