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

Comparing ibx/trunk/runtime/IBSQLMonitor.pas (file contents):
Revision 21 by tony, Thu Feb 26 10:33:34 2015 UTC vs.
Revision 31 by tony, Tue Jul 14 15:31:25 2015 UTC

# Line 44 | Line 44 | unit IBSQLMonitor;
44   interface
45  
46   uses
47  LMessages, LCLIntf, LCLType, LCLProc,  Forms, Controls, Dialogs,
47    IB, IBUtils, IBSQL, IBCustomDataSet, IBDatabase, IBServices, IBXConst,SysUtils,
48    Classes,
49   {$IFDEF WINDOWS }
# Line 71 | Line 70 | uses
70   {$DEFINE HAS_SEMTIMEDOP}
71   {$ENDIF}
72  
74 const
75  WM_MIN_IBSQL_MONITOR = WM_USER;
76  WM_MAX_IBSQL_MONITOR = WM_USER + 512;
77  WM_IBSQL_SQL_EVENT = WM_MIN_IBSQL_MONITOR + 1;
78
73   type
74    TIBCustomSQLMonitor = class;
75  
# Line 148 | Line 142 | function MonitoringEnabled: Boolean;
142   implementation
143  
144   uses
145 <   contnrs, syncobjs
145 >   contnrs, syncobjs, CustApp
146     {$IFDEF USE_SV5_IPC}
147     ,ipc, Errors, baseunix
148     {$IF FPC_FULLVERSION <= 20402 } , initc {$ENDIF}
# Line 289 | Line 283 | var
283    _MonitorHook: TIBSQLMonitorHook;
284    bDone: Boolean;
285    CS : TCriticalSection;
286 +
287 + const
288 +  ApplicationTitle: string = 'Unknown';
289    
290   { TIBCustomSQLMonitor }
291  
292   constructor TIBCustomSQLMonitor.Create(AOwner: TComponent);
293 + var aParent: TComponent;
294   begin
295    inherited Create(AOwner);
296    FTraceFlags := [tfqPrepare .. tfMisc];
297    if not (csDesigning in ComponentState)  then
298    begin
299 +    aParent := AOwner;
300 +    while aParent <> nil do
301 +    begin
302 +      if aParent is TCustomApplication then
303 +      begin
304 +        ApplicationTitle := TCustomApplication(aParent).Title;
305 +        break;
306 +      end;
307 +      aParent := aParent.Owner;
308 +    end;
309      MonitorHook.RegisterMonitor(self);
310    end;
311    FEnabled := true;
# Line 332 | Line 340 | begin
340           (st.FDataType in FTraceFlags) then
341          FOnSQLEvent(st.FMsg, st.FTimeStamp);
342    st.Free;
335  {$IFDEF WINDOWS}
336  Application.ProcessMessages
337  {$ENDIF}
343   end;
344  
345   procedure TIBCustomSQLMonitor.SetEnabled(const Value: Boolean);
# Line 702 | Line 707 | begin
707   {$IFDEF DEBUG}writeln('Write SQL Data: '+Text);{$ENDIF}
708    if not assigned(FGlobalInterface) then
709      FGlobalInterface := TGlobalInterface.Create;
710 <  Text := CRLF + '[Application: ' + Application.Title + ']' + CRLF + Text; {do not localize}
710 >  Text := CRLF + '[Application: ' + ApplicationTitle + ']' + CRLF + Text; {do not localize}
711    if not Assigned(FWriterThread) then
712      FWriterThread := TWriterThread.Create(FGLobalInterface);
713    FWriterThread.WriteSQLData(Text, DataType);
# Line 1115 | Line 1120 | finalization
1120      _MonitorHook := nil;
1121      if assigned(CS) then CS.Free;
1122    end;
1123 < end.
1123 > end.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines