91 |
|
reports.} |
92 |
|
|
93 |
|
IActivityMonitor = interface |
94 |
+ |
['{8261840a-741b-4c1c-94ea-c5c66ba72f22}'] |
95 |
|
procedure AddObject(obj: TInterfacedObject); |
96 |
|
procedure Remove(intf: TInterfacedObject); |
97 |
|
procedure SignalActivity; |
108 |
|
interface, implemented through the helper object TTransactionMonitor. |
109 |
|
} |
110 |
|
|
111 |
+ |
TOnDatabaseError = procedure of object; |
112 |
+ |
|
113 |
|
TActivityReporter = class(TInterfaceOwner) |
114 |
|
private |
115 |
|
FHasActivity: boolean; |
116 |
|
FMonitors: array of IActivityMonitor; |
117 |
+ |
FOnDatabaseError: TOnDatabaseError; |
118 |
|
function FindMonitor(aMonitor: IActivityMonitor): integer; |
119 |
|
protected |
120 |
|
function Call(ErrCode: ISC_STATUS; RaiseError: Boolean = true): ISC_STATUS; |
125 |
|
destructor Destroy; override; |
126 |
|
function HasActivity: boolean; |
127 |
|
procedure SignalActivity; |
128 |
+ |
property OnDatabaseError: TOnDatabaseError read FOnDatabaseError write FOnDatabaseError; |
129 |
|
end; |
130 |
|
|
131 |
|
{ TActivityHandler is a base class for classes that receive activity reports.} |
140 |
|
|
141 |
|
implementation |
142 |
|
|
143 |
< |
uses FB25ClientAPI; |
143 |
> |
uses FBClientAPI; |
144 |
|
|
145 |
|
{ TActivityHandler } |
146 |
|
|
194 |
|
begin |
195 |
|
result := ErrCode; |
196 |
|
SignalActivity; |
197 |
< |
if RaiseError and (ErrCode > 0) then |
198 |
< |
Firebird25ClientAPI.IBDataBaseError; |
197 |
> |
if RaiseError and (ErrCode > 0) and assigned(FOnDatabaseError) then |
198 |
> |
OnDatabaseError; |
199 |
|
end; |
200 |
|
|
201 |
|
procedure TActivityReporter.AddMonitor(aMonitor: IActivityMonitor); |