Page 1 of 1
Batch Execute SQL Script with Progress
Posted: Mon 07 Feb 2005 18:55
by Mimar
Hello,
I want to batch execute a SQL script prepared by a user on the target system. During execution I want to display progress (execution percentage of script) and also allow a choice of aborting/continuing execution.
How can I do this with MYDAC?
Sinan
Posted: Tue 08 Feb 2005 16:18
by Ikar
Use TMyScript for a script execution.
To calculate progress use StartPos, EndPos, StartLine, EndLine properties in BeforeExecute handler.
Posted: Fri 16 Jun 2006 11:28
by bravecobra
These 4 properties are not enough to calculate the whole script progress.
They only give me the position of the current sql statement in the whole script.
What do I set as max value of my progressbar (what is my 100% value)? Myscript.SQL.Count? That value is totally different of what the Final endline is. In my testprogram, I have used a script of 49 statements written in 775 lines and the final endline value turns out to be 2322.
Or do I have to "read" the whole script first (use "ExecuteNext" together with "Omit:= True") first to know what the final EndLine will be, getting the "2322" value and then rerun the whole script (use "ExecuteNext" together with "Omit:= False")? That's the only way I can get a progress bar to work.
Would the implementation of a ReadScript function (to get the final Endline value ) be wise?
Posted: Tue 20 Jun 2006 09:26
by Antaeus
> What do I set as max value of my progressbar (what is my 100% value)? Myscript.SQL.Count?
Yes, it's right value
> ... what the final EndLine will be, getting the "2322" ...
Thank you for information. This is bug of MyDAC. We have reproduced and fixed it. This fix will be included in the next MyDAC build.
> Or do I have to "read" the whole script first...
> Would the implementation of a ReadScript function (to get the final Endline value ) be wise?
No, it's not necessary. Now, after bug was fixed, final EndLine value equals to Myscript.SQL.Count - 1.
Posted: Wed 22 Nov 2006 15:29
by bravecobra
I'm kinda late in replying, but tnx