Utility functions / List of utility functions |
Starts a transaction level.
DB_START_TRANSACTION() RETURNING result INTEGER
On most database engines, you can only have a unique transaction, that you start with BEGIN WORK and you end with COMMIT WORK or ROLLBACK WORK. But in a complex program, you may have nested function calls doing several SQL transactions.
The transaction management functions execute a real transaction instruction only if the number of subsequent start/end calls of these functions matches.
DEFINE s INTEGER MAIN DATABASE mydb LET s = DB_START_TRANSACTION() -- real BEGIN WORK CALL do_update() LET s = DB_FINISH_TRANSACTION(TRUE) -- real COMMIT WORK END MAIN FUNCTION do_update() LET s = DB_START_TRANSACTION() UPDATE customer SET cust_status = 'X' LET s = DB_FINISH_TRANSACTION(TRUE) END FUNCTION