FairCom Corporation


F.18 ClearTranError


Clear an error in an active transaction.

Short Name

TRANCLR

TYPE

Low-level function

DECLARATION

COUNT ClearTranError()

DESCRIPTION

If an update error occurs when you are in the middle of a transaction, you will not be able to commit that transaction. For example, AddRecord could fail trying to add a duplicate key where they are not allowed. A subsequent call to Commit fails, since an error has occurred.

The proper way to handle this situation is to either use RestoreSavePoint to go back to a savepoint, or to abandon the entire transaction with Abort. There is an alternative, however. ClearTranError can clear the error flag, allowing you to continue with the transaction after correcting the previous error. Typically, you will only do this if you are working with low-level update functions and you know how to recover from the error that has occurred. We DO NOT recommend this, however, as you are now responsible for the integrity of your data.

RETURN

ClearTranError always returns zero (NO_ERROR).

EXAMPLE

COUNT invfil;
struct invd { TEXT delflg; LONG part_no; } recbuf;
part_no = getpartno();
recbuf.delflg = '\0'; /* clear delete flag */
if (AddRecord(invfil,&recbuf))
ClearTranError();

SEE ALSO

Abort, Begin, Commit, RestoreSavePoint, and SetSavePoint.


FairCom Corporation
www.faircom.com