FireDAC.Comp.DataSet.TFDDataSet.SavePoint
Delphi
property SavePoint: Int64 read GetSavePoint write SetSavePoint;
C++
__property __int64 SavePoint = {read=GetSavePoint, write=SetSavePoint};
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp |
FireDAC.Comp.DataSet | TFDDataSet |
Description
Gets/sets the change log version number.
Use SavePoint to get the change log current version number. Later, revert the change log to the specified version number. SavePoint can be used only in CachedUpdates mode. SavePoint can be useful for applications that use:
- The undo functionality (although there is no standard ability to implement the redo action).
- In-memory transactions.
The datasets cannot return to a SavePoint once the change log has been backed out to a prior state. This includes:
- Undoing changes by setting SavePoint to a previously saved value.
- Backing out too many changes using the RevertRecord method.
- Clearing the change log by using CancelUpdates or CommitUpdates.
Trying to set SavePoint to a state that is no longer available in the change log raises an exception.
Example
var
iSavePoint: Integer;
....
// remember changes log state
iSavePoint := FDMemTable1.SavePoint;
try
FDMemTable1.AppendRecord(....);
FDMemTable1.AppendRecord(....);
FDMemTable1.AppendRecord(....);
...
FDMemTable1.Delete;
// mark changes as persistent and clear change log
FDMemTable1.CommitUpdates;
except
// in case of exception, undo changes
FDMemTable1.SavePoint := iSavePoint;
raise;
end;