Abort

Abort the current transaction in progress.

Short Name

TRANABT()

Type

Low-Level function

Declaration

COUNT Abort()

Description

Abort() aborts the current transaction. All file update actions since the last Begin() will not be committed. All known locks are released, and the transaction ends.

Return

Value Symbolic Constant Explanation
0 NO_ERROR No error occurred.
71 TNON_ERR There is no active transaction pending.

See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Example

COUNT     savepoint;

void domaster() {
    Begin(ctENABLE|ctTRNLOG);   /* start transaction with locks  */
    while(another()); {     /* get next record to add        */
        savepoint = SetSavePoint(); /* get save point at
                             beginning of each master record */
        if (add_master() < 0)
            Abort();        /* abort if can't add master rec */
        dodetail();         /* process detail records        */
    }
    if (Commit(ctFREE)0)
        printf("\nError %d in transaction",uerr_cod);
    return;
}

void dodetail() {
    while(moredetail()); {   /*get next detail record to add */
        if (add_detail()<0) {    /* add details, if possible */
            RestoreSavePoint(savepoint)
                             /* with error, return to savept */
            return;
        }
    }
}

See also

AbortXtd, Begin, ClearSavePoint, Commit, RestoreSavePoint, SetSavePoint, TRANRDY