ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBDatabase.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBDatabase.pas (file contents):
Revision 19 by tony, Mon Jul 7 13:00:15 2014 UTC vs.
Revision 21 by tony, Thu Feb 26 10:33:34 2015 UTC

# Line 279 | Line 279 | type
279  
280    TIBTransaction = class(TComponent)
281    private
282 +    FAfterTransactionEnd: TNotifyEvent;
283 +    FBeforeTransactionEnd: TNotifyEvent;
284      FIBLoaded: Boolean;
285      FCanTimeout         : Boolean;
286      FDatabases          : TList;
# Line 295 | Line 297 | type
297      FTRParams           : TStrings;
298      FTRParamsChanged    : Boolean;
299      FInEndTransaction   : boolean;
300 +    FEndAction          : TTransactionAction;
301 +    procedure DoBeforeTransactionEnd;
302 +    procedure DoAfterTransactionEnd;
303      procedure EnsureNotInTransaction;
304      procedure EndTransaction(Action: TTransactionAction; Force: Boolean);
305      function GetDatabase(Index: Integer): TIBDatabase;
# Line 336 | Line 341 | type
341      function AddDatabase(db: TIBDatabase): Integer;
342      function FindDatabase(db: TIBDatabase): Integer;
343      function FindDefaultDatabase: TIBDatabase;
344 +    function GetEndAction: TTransactionAction;
345      procedure RemoveDatabase(Idx: Integer);
346      procedure RemoveDatabases;
347      procedure CheckDatabasesInList;
# Line 357 | Line 363 | type
363      property DefaultAction: TTransactionAction read FDefaultAction write SetDefaultAction default taCommit;
364      property Params: TStrings read FTRParams write SetTRParams;
365      property OnIdleTimer: TNotifyEvent read FOnIdleTimer write FOnIdleTimer;
366 +    property BeforeTransactionEnd: TNotifyEvent read FBeforeTransactionEnd
367 +                                             write FBeforeTransactionEnd;
368 +    property AfterTransactionEnd: TNotifyEvent read FAfterTransactionEnd
369 +                                            write FAfterTransactionEnd;
370    end;
371  
372    { TIBBase }
# Line 1384 | Line 1394 | begin
1394      IBError(ibxeNotInTransaction, [nil]);
1395   end;
1396  
1397 + procedure TIBTransaction.DoBeforeTransactionEnd;
1398 + begin
1399 +  if Assigned(FBeforeTransactionEnd) then
1400 +    FBeforeTransactionEnd(self);
1401 + end;
1402 +
1403 + procedure TIBTransaction.DoAfterTransactionEnd;
1404 + begin
1405 +  if Assigned(FAfterTransactionEnd) then
1406 +    FAfterTransactionEnd(self);
1407 + end;
1408 +
1409   procedure TIBTransaction.EnsureNotInTransaction;
1410   begin
1411    if csDesigning in ComponentState then
# Line 1460 | Line 1482 | begin
1482    CheckInTransaction;
1483    if FInEndTransaction then Exit;
1484    FInEndTransaction := true;
1485 +  FEndAction := Action;
1486    try
1487    case Action of
1488      TARollback, TACommit:
# Line 1468 | Line 1491 | begin
1491           (Action <> FDefaultAction) and
1492           (not Force) then
1493          IBError(ibxeCantEndSharedTransaction, [nil]);
1494 +      DoBeforeTransactionEnd;
1495        for i := 0 to FSQLObjects.Count - 1 do if FSQLObjects[i] <> nil then
1496          SQLObjects[i].DoBeforeTransactionEnd;
1497        if InTransaction then
# Line 1492 | Line 1516 | begin
1516              IBDataBaseError;
1517          for i := 0 to FSQLObjects.Count - 1 do if FSQLObjects[i] <> nil then
1518            SQLObjects[i].DoAfterTransactionEnd;
1519 +        DoAfterTransactionEnd;
1520        end;
1521      end;
1522      TACommitRetaining:
# Line 1582 | Line 1607 | begin
1607    end;
1608   end;
1609  
1610 + function TIBTransaction.GetEndAction: TTransactionAction;
1611 + begin
1612 +  if FInEndTransaction then
1613 +     Result := FEndAction
1614 +  else
1615 +     IBError(ibxeIB60feature, [nil])
1616 + end;
1617 +
1618  
1619   function TIBTransaction.GetIdleTimer: Integer;
1620   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines