TFloDataSource.RollbackTran
This rolls back a new database transaction that was started using StartTransaction against the Data Definition.
Database transactions are handled automatically so you do not normally need to use this function unless you want specific control over database transactions.
Any transactions you start with StartTransaction will need to be finalised by you with either CommitTran or RollbackTran.
Declaration: Function RollbackTran : boolean
This is a simple example.
procedure
OnMapEvent(
var
Value:Variant);
begin
//Check the flag Global1 to determine whether you want the transaction
//If not, then roll it back
If
Global1 =
False
then
Dest
.
RollbackTran;
end
;
And the following example illustrates the relationship between RollbackTran and CommitTran.
procedure
OnMapEvent(
var
Value:Variant);
begin
//check that the transaction has started
if
Not
Source
.
CommitTran
then
begin
LogError(
'Unable to commit transaction'
);
//If it fails to commit then you need to rollback
Source
.
RollbackTran;
end
;
end
;
For more information, please also refer to TFloDataSource.StartTransaction and TFloDataSource.CommitTran.