ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/client/FBActivityMonitor.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/FBActivityMonitor.pas (file contents):
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC vs.
Revision 263 by tony, Thu Dec 6 15:55:01 2018 UTC

# Line 37 | Line 37 | unit FBActivityMonitor;
37   interface
38  
39   uses
40 <  Classes, SysUtils, IBExternals;
40 >  Classes, SysUtils, IBExternals, IB;
41  
42    { $DEFINE DEBUGINTERFACES}   {Define this to check that all interfaces are
43                                  being destroyed.}
# Line 107 | Line 107 | type
107      interface, implemented through the helper object TTransactionMonitor.
108    }
109  
110 +  TOnDatabaseError = procedure of object;
111 +
112    TActivityReporter = class(TInterfaceOwner)
113    private
114      FHasActivity: boolean;
115      FMonitors: array of IActivityMonitor;
116 +    FOnDatabaseError: TOnDatabaseError;
117      function FindMonitor(aMonitor: IActivityMonitor): integer;
118    protected
119      function Call(ErrCode: ISC_STATUS; RaiseError: Boolean = true): ISC_STATUS;
# Line 121 | Line 124 | type
124      destructor Destroy; override;
125      function HasActivity: boolean;
126      procedure SignalActivity;
127 +    property OnDatabaseError: TOnDatabaseError read FOnDatabaseError write FOnDatabaseError;
128    end;
129  
130    { TActivityHandler is a base class for classes that receive activity reports.}
# Line 135 | Line 139 | type
139  
140   implementation
141  
142 < uses FB25ClientAPI;
142 > uses FBClientAPI;
143  
144   { TActivityHandler }
145  
# Line 189 | Line 193 | function TActivityReporter.Call(ErrCode:
193   begin
194    result := ErrCode;
195    SignalActivity;
196 <  if RaiseError and (ErrCode > 0) then
197 <    Firebird25ClientAPI.IBDataBaseError;
196 >  if RaiseError and (ErrCode > 0) and assigned(FOnDatabaseError) then
197 >    OnDatabaseError;
198   end;
199  
200   procedure TActivityReporter.AddMonitor(aMonitor: IActivityMonitor);
# Line 308 | Line 312 | end;
312  
313   function TInterfaceOwner.HasInterface(index: integer): boolean;
314   begin
315 <  Result := FInterfaces[index] <> nil;
315 >  Result := (Length(FInterfaces) > 0) and (FInterfaces[index] <> nil);
316   end;
317  
318   procedure TInterfaceOwner.Remove(intf: TInterfacedObject);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines