DB_Undo

DB_Undo removes all changes made to the database since the last Undo point was set. Undo sets an Undo point before it begins executing so that Undoing an Undo is the same as doing nothing. DB_CANTUNDO is returned if no actions have been performed on the database since the last Undo point. If the undocount pointer is not NULL, the integer at undocount is filled with the number of records affected by the Undo.

If the undoret pointer is not NULL, the pointer at undoret is filled with the address of the System Manager memory "handle" that points (doubly indirect) to an memory block. This new memory block is allocated by the database, but the application is responsible for deleting the block when it is done examining the entries. The undoret array that lies in this block gives the record numbers, types, and actions of any records that have changed. The action code indicates what was done to restore the record, not what happened to the original record (i.e. if after an Undo, a record that was previously deleted is re-added, the action code will be UNDO_ADDED). If the undoret pointer is not NULL, and there is not enough memory to allocate the undoret array, DB_Undo returns with a DB_MEMORY error.

DB_Undo also flushes the DOS file after completing.