F.24 Commit
Commit the current transaction in progress.
Short Name
TRANEND
TYPE
Low-level data file function
DECLARATION
COUNT Commit(COUNT mode)DESCRIPTION
Commits all file updates for files that support transactions, which means that the updates go to the data files from the preimage buffers.
The parameter mode can be one of the following:
Note: If an update error has occurred, such as an AddRecord failing due to a duplicate key, Commit returns a PNDG_ERR error and aborts the transaction. The error condition can be cleared prior to the call to Commit with a call to ClearTranError, at the great risk of corrupting data, or by backing up to a savepoint set with RestoreSavePoint before the error occurred.RETURN
See Appendix A "c-tree Plus Error Codes" of the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
EXAMPLE
Begin(ctENABLE|ctTRNLOG); /* Start transaction with locks */while(another()) /* Get next record to add */{if (add_master() < 0) {printf(Error adding record.\n");Abort(); /* Abort if can't add master rec. */return(-1);}dodetail(); /* Process detail records */}if (Commit(ctFREE) > 0)printf("\nError %d in transaction",uerr_cod);SEE ALSO
Begin, Abort, ClearTranError, SetSavePoint, and RestoreSavePoint. For a full description of transaction processing, see the Chapter 13 "Data Integrity" of the c-tree Plus Programmer's Reference Guide.
|
FairCom Corporation www.faircom.com |