| COMMIT TRANSACTION | Index Level | COMMON |
| Syntax | COMMIT {WORK|TRANSACTION} {THEN | ELSE statement.block} |
| Category | BASIC |
| Type | Statement |
| Description |
Commits a transaction
This operation reliably logs all updates made since the last "begin work" command to the database in an atomic fashion. If the system halts during the commit, then the coldstart procedure automatically rolls forward the commit when the machine recovers. If the commit cannot be rolled-forward at that time (because of a missing file, trigger, etc), then that transaction is rolled back. If the roll back fails, then the transaction is aborted and an error message is printed to the screen and the errors file. If the commit fails under normal operations, then the entire transaction is undone and the "else" statement.block is taken if present. Note that in this case, it is necessary to completely re-do all updates performed by the transaction (after correcting the problem which led to the failure). It is invalid to have a bridge or callx on a file which is updated within a transaction. The inclusion of these items may cause unpredictable results. |
| Options | |
| See Also | BEGIN WORK COMMIT TRANSACTION TRANSACTION COMMIT _CP_trans |
| Example |
open "myfile" to f1
open "mylog" to f2 begin work readu total from f1,"total" total = total + 1 write total on f1,"total" write total on f2,timedate();* create synchronized log commit work else print "Could not update" |
| Warnings | |
| Compatibility | D3 7.0 |
| COMMIT TRANSACTION | Index Level | COMMON |