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 7 by tony, Sun Aug 5 18:28:19 2012 UTC vs.
Revision 39 by tony, Tue May 17 08:14:52 2016 UTC

# Line 41 | Line 41 | unit IBSQLMonitor;
41  
42   {$Mode Delphi}
43  
44 + {$IF FPC_FULLVERSION >= 20700 }
45 + {$codepage UTF8}
46 + {$ENDIF}
47 +
48   interface
49  
50   uses
47  LMessages, LCLIntf, LCLType, LCLProc,  Forms, Controls, Dialogs,
51    IB, IBUtils, IBSQL, IBCustomDataSet, IBDatabase, IBServices, IBXConst,SysUtils,
52    Classes,
53   {$IFDEF WINDOWS }
# Line 71 | Line 74 | uses
74   {$DEFINE HAS_SEMTIMEDOP}
75   {$ENDIF}
76  
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
77   type
78    TIBCustomSQLMonitor = class;
79  
# Line 148 | Line 146 | function MonitoringEnabled: Boolean;
146   implementation
147  
148   uses
149 <   contnrs, syncobjs
149 >   contnrs, syncobjs, CustApp
150     {$IFDEF USE_SV5_IPC}
151     ,ipc, Errors, baseunix
152     {$IF FPC_FULLVERSION <= 20402 } , initc {$ENDIF}
# Line 289 | Line 287 | var
287    _MonitorHook: TIBSQLMonitorHook;
288    bDone: Boolean;
289    CS : TCriticalSection;
290 +
291 + const
292 +  ApplicationTitle: string = 'Unknown';
293    
294   { TIBCustomSQLMonitor }
295  
296   constructor TIBCustomSQLMonitor.Create(AOwner: TComponent);
297 + var aParent: TComponent;
298   begin
299    inherited Create(AOwner);
300    FTraceFlags := [tfqPrepare .. tfMisc];
301    if not (csDesigning in ComponentState)  then
302    begin
303 +    aParent := AOwner;
304 +    while aParent <> nil do
305 +    begin
306 +      if aParent is TCustomApplication then
307 +      begin
308 +        ApplicationTitle := TCustomApplication(aParent).Title;
309 +        break;
310 +      end;
311 +      aParent := aParent.Owner;
312 +    end;
313      MonitorHook.RegisterMonitor(self);
314    end;
315    FEnabled := true;
# Line 332 | Line 344 | begin
344           (st.FDataType in FTraceFlags) then
345          FOnSQLEvent(st.FMsg, st.FTimeStamp);
346    st.Free;
335  {$IFDEF WINDOWS}
336  Application.ProcessMessages
337  {$ENDIF}
347   end;
348  
349   procedure TIBCustomSQLMonitor.SetEnabled(const Value: Boolean);
# Line 702 | Line 711 | begin
711   {$IFDEF DEBUG}writeln('Write SQL Data: '+Text);{$ENDIF}
712    if not assigned(FGlobalInterface) then
713      FGlobalInterface := TGlobalInterface.Create;
714 <  Text := CRLF + '[Application: ' + Application.Title + ']' + CRLF + Text; {do not localize}
714 >  Text := CRLF + '[Application: ' + ApplicationTitle + ']' + CRLF + Text; {do not localize}
715    if not Assigned(FWriterThread) then
716      FWriterThread := TWriterThread.Create(FGLobalInterface);
717    FWriterThread.WriteSQLData(Text, DataType);
# Line 1097 | Line 1106 | initialization
1106    if FpGetEnv('FBSQL_IPCFILENAME') <> nil then
1107      IPCFileName := strpas(FpGetEnv('FBSQL_IPCFILENAME'))
1108    else
1109 <    IPCFileName := '/tmp/' + IPCFileName + '.' + strpas(FpGetEnv('USER'));
1109 >    IPCFileName := GetTempDir(true) + IPCFileName + '.' + strpas(FpGetEnv('USER'));
1110   {$ENDIF}
1111  
1112   finalization

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines