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.} |
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; |
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.} |
139 |
|
|
140 |
|
implementation |
141 |
|
|
142 |
< |
uses FB25ClientAPI; |
142 |
> |
uses FBClientAPI; |
143 |
|
|
144 |
|
{ TActivityHandler } |
145 |
|
|
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); |
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); |