Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Comix 3.0 Reference Manual - <b>cmxrollback()</b> rollback changes made to current record http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
cmxRollback()         Rollback changes made to current record
------------------------------------------------------------------------------

Synopsis

    cmxRollback() -> NIL

Arguments

    None.

Returns

    NIL.

Description

    cmxRollback() allows you to rollback changes made to the current
    record.  This is useful to allow direct input of values to fields,
    and simply discard them if the user does not want to make the
    changes permanent (i.e., eliminates SCATTER/GATHER routines).

    Internally when Clipper updates fields, it makes the changes to an
    internal record buffer.  The new values are not actually written to
    the database until a SKIP, UNLOCK, COMMIT or other record
    positioning command is done.

    cmxRollback() discards the contents of the in memory record buffer
    (i.e., any updates made) and rereads the record from the database.
    All indexes are properly handled to stay in sync with the database.

    NOTE:   You _cannot_ rollback an APPEND BLANK.  A blank record is
            physically added to the database as part of the APPEND BLANK.

Example

    function test()
        field age
        local lOk := .f.

        use demo

        cls
        @ 0, 0 say "Age: " get age          // Get input directly
        read

        @ 1, 0 say " OK? " get lOk          // Check if OK
        read

        if (!lOk)
            cmxRollback()                   // If not, rollback changes
        else
            skip 0                          // Otherwise commit changes
        endif

        ? "New Age is: ", age               // Will output actual age
    return nil

See Also

    None.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson