如何使用delphi xe10跟踪服务firebird服务器的所有事件?
这是我的代码:
my := TIBControlService.Create(Self);
my.ServerName := '127.0.0.1/3050';
my.Protocol := TProtocol.TCP;
my.LoginPrompt := false;
my.TraceFlags := [tfQPrepare, tfQExecute, tfQFetch, tfError, tfStmt, tfConnect, tfTransact, tfBlob, tfService, tfMisc];
my.Params.Add( 'user_name=SYSDBA' );
my.Params.Add( 'password=masterkey' );
// -----
mh := MonitorHook;
mh.TraceFlags := my.TraceFlags;
Self.IBSQLMonitor1.TraceFlags := my.TraceFlags;
mh.RegisterMonitor(Self.IBSQLMonitor1);
Self.IBSQLMonitor1.Enabled := true;
Memo1.Lines.Add( Format('GetMonitorCount: %d',[mh.GetMonitorCount]) );
my.Attach;
Memo1.Lines.Add( Format('Active: %s',[System.StrUtils.IfThen(my.Active,'yes','no')]) );
and
procedure TForm1.IBSQLMonitor1SQL(EventText: string; EventTime: TDateTime);
begin
Memo1.Lines.Add(EventText);
end;
Result:
GetMonitorCount: 1
Active: yes
[Application:]
:[Attach]
[Application:]
:[Query]
但这个结果只是来自我的申请。当我从另一个进程(例如)连接时,我的应用程序不显示此事件。