in order to this posting http://forums.devart.com/viewtopic.php?t=17330 I have changed my code to the example which you published there.
But I only get the current TickCountValue and not the duration. Is there still an easier way do monitor the sql statements duration or what can be wrong?
I am using UniDAC with Delphi 2010 Professional.
Code: Select all
TUniSqlMonitorEx = class(TUniSqlMonitor)
private
FExecuteDuration: Cardinal;
protected
procedure InternalSQLExecute(Obj: TObject; const SQL: string; Params: TDAParams; const Caption: string; BeforeEvent: boolean; var MessageID: Cardinal); override;
public
property ExecuteDuration: Cardinal read FExecuteDuration;
end;Code: Select all
procedure TUniSqlMonitorEx.InternalSQLExecute(Obj: TObject;
const SQL: string; Params: TDAParams; const Caption: string;
BeforeEvent: boolean; var MessageID: Cardinal);
begin
if BeforeEvent then
FExecuteDuration := GetTickCount;
inherited;
if not BeforeEvent then
FExecuteDuration := (GetTickCount - FExecuteDuration);
end;Code: Select all
USQLMonitor := TUniSqlMonitorEx.Create(Application.Owner);
USQLMonitor.OnSQL := USQLMonitorSQL;Code: Select all
WriteLog(0, FloatToStr(USQLMonitor.ExecuteDuration), Text);NetSonic