Transaction and functions

Discussão em 'StackOverflow' iniciado por fdantas, Março 1, 2016.

  1. fdantas

    fdantas Administrator Moderador

    We are using functions in a single .p-file, like the following:

    myTest.p

    BLOCK-LEVEL ON ERROR UNDO, THROW.

    FUNCTION secondFunc RETURNS LOG ():
    UNDO, THROW NEW Progress.Lang.AppError("ERROR HAPPENED, UNDO ALL!").
    END FUNCTION.

    FUNCTION firstFunc RETURNS LOG ():
    secondFunc().
    END FUNCTION.

    FUNCTION starter RETURNS LOG ():

    /* start transaction */
    DO TRANSACTION:
    firstFunc().
    END.
    END FUNCTION.

    /* start execution of the function tree */
    starter().

    CATCH err AS Progress.Lang.Error:
    RUN WRITE_log(err:GetMessage(1)).
    MESSAGE err:GetMessage(1) VIEW-AS ALERT-BOX.
    RETURN ERROR. /* return error status to upper level */
    END.


    According to this code, does the Transaction undo all changed done inside it in starter()-function? Or do we need to pass some kind of handle to all functions inside the Transaction so it can be "undone"?

    Continue reading...

Compartilhe esta Página