Ends a transaction and makes permanent all changes you made during that transaction.
1 – Examples
The following programs demonstrate the use of the commit statement to make permanent changes to a field value in a database. These programs: o Use a record selection expression to find an employee in the EMPLOYEES relation with the ID number "00193" o Use a MODIFY statement to change the field value of E.LAST_NAME for this employee Although this change is written to the database at the time of the MODIFY, the change is not permanent until the programs issue a COMMIT statement. After the programs issue the COMMIT statement the old value for E.LAST_NAME is not available. The C example uses the function pad_string to pad the name "Smith-Fields" with blanks. Blanks are appended to the name so that the length of the name matches the spaces reserved for it in the database definition for LAST_NAME.
1.1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; extern void pad_string(); main() { READY PERS; START_TRANSACTION READ_WRITE; FOR E IN EMPLOYEES WITH E.EMPLOYEE_ID = '00193' MODIFY E USING pad_string ("Smith-Fields", E.LAST_NAME, sizeof(E.LAST_NAME)); END_MODIFY; END_FOR; COMMIT; FINISH; }
1.2 – Pascal Example
program commit_changes (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; begin READY PERS; START_TRANSACTION READ_WRITE; FOR E IN EMPLOYEES WITH E.EMPLOYEE_ID = '00193' MODIFY E USING E.LAST_NAME := 'Smith-Fields'; END_MODIFY; END_FOR; COMMIT; FINISH; end.
2 – Format
(B)0[m[4mCOMMIT[m qqwqq>qqqqqqqqqqqqqqqqqq>qqqqqqqqqqqqqqqqqqqqqwk mqq> ( qq> [4mTRANSACTION_HANDLE[m qq> var qq>) qjx x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x mqqqqqqqqqqqwqq>qqqqqqqqqqqqqqqwqqqqqqqqqqqqqq> mqq> on-error qqqj
2.1 – Format arguments
TRANSACTION_HANDLE The TRANSACTION_HANDLE keyword followed by var a host language variable. A transaction handle identifies a transaction. If you do not supply a transaction handle explicitly, RDML uses the default transaction handle. on-error The ON ERROR clause. Specifies host language statement(s) to be performed if an error occurs during the COMMIT operation. For more information see the entry on ON ERROR.