is it possible to disable the monitor just for some objects?
We have an application that dynamically creates IBCQuerys. And we use the IBCSQLMonitor.OnSQL to log all things. So far so good.
But if we try to Use another IBCQuery with an extra IBCConnection to log the Text into a Database the problems start. Database-Exceptions,Subcomponents like Params.create, DB-Events etc. end up in an infinite loop which kills after some Time the hole application (Max List-Index or No Memory available);
So An Option e.g. like "IBCConnection1.EnableMonitoring:=False" disable the OnSQL Event for all Objects that Use IBCConnection1 would be helpfull.
Code: Select all
procedure TDataBaseDataModule.IBCSQLMonitor1SQL(Sender: TObject; Text: string;
Flag: TDATraceFlag);
var l:string;
begin
//This code is kind of dirty. And we don't like to Use it like this.
// Database-Exceptions are catched here and Ended in an Infinity-Log-Loop
// Some Kind of IBCQuery.Monitoring:=False (Default: True) would be helpfull
try
l:='';
if Sender.ClassType = TIBCConnection then
l:='TIBCConnection:'+TIBCConnection(Sender).Name else
if Sender.ClassType = TIBCTransaction then
l:='Transaktion:'+TIBCTransaction(Sender).DefaultConnection.Name else
if Sender.ClassType = TIBCQuery then
l:='TIBCQuery:'+TIBCQuery(sender).Name else
if Sender.ClassType = TIBCStoredProc then
l:='TIBCStoredProc:'+TIBCStoredProc(Sender).Name
else l:='TComponent:'+TComponent(Sender).Name;
if Pos('DBLog',l)>0 then Exit;
except
on e:exception do
begin
//nothing special for now
end;
end;
// if _Konfiguration.isSQLProtokoll then
case Flag of
// tfQPrepare: ;
// tfQExecute: ;
// tfQFetch: ;
tfError: LogIntoDBandFile(ltError,feSQL,Text,now,True);
// tfStmt: ;
// tfConnect: ;
// tfTransact: ;
// tfBlob: ;
// tfService: ;
// tfMisc: ;
// tfParams: ;
// tfObjDestroy: ;
// tfPool: ;
else LogIntoDBandFile(ltInfo,feSQL,Text,now,True);
end;
end;