Reputation: 62474
How can I make a progress-bar in copy or SQL query or file transfer (rapi)?
Or some thing's that I can't measure?
Thanks for any help.
Upvotes: 0
Views: 1246
Reputation: 10827
Set the progress bar to marquee instead of progress. This will let your users know that something is still happening without providing exact percentages.
Upvotes: 2
Reputation: 103457
It really depends on how architect your code.
As far as I know, there is no API for tracking the progress of a task such as copying files or running SQL commands. If you want to be able to track progress, you'll have to devise some sort of way to break the task up into measurable tasks, then use that as your progress benchmark.
For example, if you were doing a series of SQL INSERT
queries, measure the number of queries you will need (if possible). Keep a count of how many inserts
you've performed so far. Every time you finish a query, you can do some simple math to measure your progress since you've got your total queries required, and your queries so far.
Upvotes: 0
Reputation: 614
Well... really since you can't measure you just have to guess. You ever installed windows and the progress bar is very slow to move but then all of a sudden it jumps a great deal?
A couple ideas. If you have only one SQL query then you could slowly move the progress bar over time (like 0.5% per second?). Then if the the query hasn't finished by the time it hits 90% stop it. Then don't let it finish until it is done. If it finishes early (while the slow climb is going on) just jump to 100%.
Another idea is to run the query many times over to figure out an average time. Use this to do the same thing I mentioned in the last paragraph, but with the average time you can probably make the increments match better with the real progress.
Good luck!
Upvotes: -1