Logging execution and results of query and script
Logging execution and results of query and script
Hello,
How to get log of execution a query or a script ?
For example, I want to know if all queries in the script are executed well.
Regards
Michal
How to get log of execution a query or a script ?
For example, I want to know if all queries in the script are executed well.
Regards
Michal
Re: Logging execution and results of query and script
For UniScript, use OnError event to catch errors.
Re: Logging execution and results of query and script
Thanks,
There is a way to get information if a query went well.
The OnError event gets only error messages, I suppose.
There is a way to disable displaying error messages on screen, storing them only in a log file (created using onError event).
Regards
Michal
There is a way to get information if a query went well.
The OnError event gets only error messages, I suppose.
There is a way to disable displaying error messages on screen, storing them only in a log file (created using onError event).
Regards
Michal
Re: Logging execution and results of query and script
Hello,
To skip errors occurring during script execution in TUniScript, you should set the Action parameter to eaContinue in the onError event, in this case if an error occurs, it will be ignored and execution will continue.
To skip errors occurring during script execution in TUniScript, you should set the Action parameter to eaContinue in the onError event, in this case if an error occurs, it will be ignored and execution will continue.
Re: Logging execution and results of query and script
Hello,
Thanks for your reply.
Will be errors reported in the onError event when I set the "Action" parameter to eaContinue ?
I want to store event log to a log file when a script is executed. This way I must store success event and error events. When an error occurs I don't want the error message on the screen, I want it only in the log file. How to do this?
Regards
Michal
Thanks for your reply.
Will be errors reported in the onError event when I set the "Action" parameter to eaContinue ?
I want to store event log to a log file when a script is executed. This way I must store success event and error events. When an error occurs I don't want the error message on the screen, I want it only in the log file. How to do this?
Regards
Michal
Re: Logging execution and results of query and script
hello,
To log scripts execution, you can use the AfterExecute event, and for error logging - the onError event. The following sample demonstrates work with these events:
P.S. If you run the application from the IDE, and the Stop On Delphi Exception option is enabled, an error message will be shown in any way, independently on the Action parameter value; when running the application from *.exe - an error won't be shown ( Action = eaContinue)
To log scripts execution, you can use the AfterExecute event, and for error logging - the onError event. The following sample demonstrates work with these events:
Code: Select all
var
error: boolean;
..
procedure TForm1.UniScript1Error(Sender: TObject; E: Exception;
SQL: String; var Action: TErrorAction);
begin
//error logging
error := True;
Action := eaContinue;
end;
procedure TForm1.UniScript1AfterExecute(Sender: TObject; SQL: String);
begin
if not Error then begin
//successful script execution logging
error := False;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
error := False;
UniScript1.Execute;
end;Re: Logging execution and results of query and script
Hello,
Thanks for yor reply and advice.
Regards
Michal
Thanks for yor reply and advice.
Regards
Michal
Re: Logging execution and results of query and script
Hello,
If you have any other questions, feel free to contact us
If you have any other questions, feel free to contact us