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

Comparing ibx/trunk/runtime/nongui/IBSQLMonitor.pas (file contents):
Revision 322 by tony, Thu Feb 25 12:05:40 2021 UTC vs.
Revision 323 by tony, Thu Feb 25 12:14:35 2021 UTC

# Line 159 | Line 159 | type
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);
# Line 218 | Line 219 | type
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 }
# Line 304 | Line 305 | var
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);
# Line 336 | Line 337 | constructor TIBSQLMonitorHook.Create;
337   begin
338    inherited Create;
339    FTraceFlags := [tfQPrepare..tfMisc];
339  FIPCInterface := CreateIPCInterface;
340    FEnabled := false;
341   end;
342  
# Line 393 | Line 393 | end;
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);
# Line 522 | Line 524 | begin
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}
# Line 741 | Line 744 | begin
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}
# Line 826 | Line 835 | begin
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines