159 |
|
FTraceFlags: TTraceFlags; |
160 |
|
FEnabled: Boolean; |
161 |
|
FWriteCount: integer; |
162 |
+ |
procedure NeedIPCInterface; |
163 |
|
protected |
164 |
< |
procedure WriteSQLData(Text: String; DataType: TTraceFlag); |
164 |
> |
procedure WriteSQLData(Text: String; DataType: TTraceControlFlag); |
165 |
|
public |
166 |
|
constructor Create; |
167 |
|
procedure RegisterMonitor(SQLMonitor : TIBCustomSQLMonitor); |
219 |
|
public |
220 |
|
constructor Create(IPCInterface: IIPCInterface); |
221 |
|
destructor Destroy; override; |
222 |
< |
procedure WriteSQLData(Msg : String; DataType : TTraceFlag); |
222 |
> |
procedure WriteSQLData(Msg : String; DataType : TTraceControlFlag); |
223 |
|
end; |
224 |
|
|
225 |
|
{ TReaderThread } |
305 |
|
st: TTraceObject; |
306 |
|
begin |
307 |
|
st := (Msg as TTraceObject); |
308 |
< |
if (Assigned(FOnSQLEvent)) and |
309 |
< |
(st.FDataType in FTraceFlags) then |
308 |
> |
if (Assigned(FOnSQLEvent)) and ((st.FDataType = tfDisabled) or |
309 |
> |
(st.FDataType in FTraceFlags)) then |
310 |
|
FOnSQLEvent(st.FMsg, st.FTimeStamp); |
311 |
|
if assigned(OnMonitoringDisabled) and (st.FDataType = tfDisabled) then |
312 |
|
OnMonitoringDisabled(self); |
337 |
|
begin |
338 |
|
inherited Create; |
339 |
|
FTraceFlags := [tfQPrepare..tfMisc]; |
339 |
– |
FIPCInterface := CreateIPCInterface; |
340 |
|
FEnabled := false; |
341 |
|
end; |
342 |
|
|
393 |
|
procedure TIBSQLMonitorHook.RegisterMonitor(SQLMonitor: TIBCustomSQLMonitor); |
394 |
|
begin |
395 |
|
{$IFDEF DEBUG}writeln('Register Monitor');{$ENDIF} |
396 |
< |
if not Assigned(FReaderThread) then |
396 |
> |
NeedIPCInterface; |
397 |
> |
if not Assigned(FReaderThread) then |
398 |
|
FReaderThread := TReaderThread.Create(FIPCInterface); |
399 |
|
FReaderThread.AddMonitor(SQLMonitor); |
400 |
|
end; |
401 |
|
|
402 |
|
procedure TIBSQLMonitorHook.ReleaseMonitor(Arg: TIBCustomSQLMonitor); |
403 |
|
begin |
404 |
< |
FWriterThread.ReleaseMonitor(Arg); |
404 |
> |
if FWriterThread <> nil then |
405 |
> |
FWriterThread.ReleaseMonitor(Arg); |
406 |
|
end; |
407 |
|
|
408 |
|
procedure TIBSQLMonitorHook.SendMisc(Msg: String); |
524 |
|
FEnabled := Value; |
525 |
|
if FEnabled then |
526 |
|
begin |
527 |
+ |
NeedIPCInterface; |
528 |
|
if not Assigned(FWriterThread) then |
529 |
|
FWriterThread := TWriterThread.Create(FIPCInterface); |
530 |
|
(* {$ifdef UNIX} |
744 |
|
{$IFDEF DEBUG}writeln('Unregister done'){$ENDIF} |
745 |
|
end; |
746 |
|
|
747 |
+ |
procedure TIBSQLMonitorHook.NeedIPCInterface; |
748 |
+ |
begin |
749 |
+ |
if FIPCInterface = nil then |
750 |
+ |
FIPCInterface := CreateIPCInterface; |
751 |
+ |
end; |
752 |
+ |
|
753 |
|
procedure TIBSQLMonitorHook.WriteSQLData(Text: String; |
754 |
< |
DataType: TTraceFlag); |
754 |
> |
DataType: TTraceControlFlag); |
755 |
|
begin |
756 |
|
// {$IFDEF DEBUG}writeln('Write SQL Data: '+Text);{$ENDIF} |
757 |
|
Text := LineEnding + '[Application: ' + ApplicationTitle + ']' + LineEnding + Text; {do not localize} |
835 |
|
{$IFDEF DEBUG}writeln('Write Thread Ends');{$ENDIF} |
836 |
|
end; |
837 |
|
|
838 |
< |
procedure TWriterThread.WriteSQLData(Msg : String; DataType: TTraceFlag); |
838 |
> |
procedure TWriterThread.WriteSQLData(Msg: String; DataType: TTraceControlFlag); |
839 |
|
begin |
840 |
|
FCriticalSection.Enter; |
841 |
|
try |