query progress/feedback
query progress/feedback
is there any way (other than implementing a query in a thread) or preventing my application hanging when running complex queries on large databases that take a few 10's of seconds to return?
Some method of calling application->ProcessMessages() to ensure that the app doesn't freeze would be enough
Some method of calling application->ProcessMessages() to ensure that the app doesn't freeze would be enough
Is it in future plans?
I tried to do it my self, it works in simple cases
but it is unpredictible - it crashes time to time - becouse of alot of stuff working same time
I used this approach:
i have everything created in main thread, and execution of queries running in other thread. During query execution main thread is displaying some progressbar or some animation. Also main thread processes messages (except ones in WM_MOUSEFIRST-WM_MOUSELAST and WM_KEYFIRST-WM_KEYLAST) - in such way - application can be resized, moved and so on
I put DisableControls and EnableControls to disable grids and other components that displays data.
But still some unexplainable exceptions rises
I tried to do it my self, it works in simple cases
but it is unpredictible - it crashes time to time - becouse of alot of stuff working same time
I used this approach:
i have everything created in main thread, and execution of queries running in other thread. During query execution main thread is displaying some progressbar or some animation. Also main thread processes messages (except ones in WM_MOUSEFIRST-WM_MOUSELAST and WM_KEYFIRST-WM_KEYLAST) - in such way - application can be resized, moved and so on
I put DisableControls and EnableControls to disable grids and other components that displays data.
But still some unexplainable exceptions rises
-
swierzbicki
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
Hi eimix,
I've just discovered this great library today : OmniThreadLibrary
Quoted from their website :
Download : http://code.google.com/p/omnithreadlibr ... loads/list
I've created a simple project :
1 Form with :
- 1 Grid ,
- 1 Datasource,
- 1 MyQuery,
- 1 MyConnection,
- 1 Button.
When clicking on the button I'm executing an SQL Query that is fetching more than 700 000 records (table has about 30 fields). The query is executed inside a thread (very very easy thanks to omnithread). The only thing that I needed to do was a MyQuery.DisableControl / MyQuery.EnableControl.
I've just discovered this great library today : OmniThreadLibrary
Quoted from their website :
Faq : http://otl.17slon.com/faq.htmWhat is OmniThreadLibrary?
OmniThreadLibrary is a simple to use threading library for Delphi. OTL's main "selling" points (besides the prices, of courseare power, simplicity, and openess. With just few lines of code, you can set up multiple threads, send messages between them, process Windows messages and more. OTL doesn't limit you in any way - if it is not powerfull enough for you, you can ignore any part of its "smartness" and replace it with your own code.
Download : http://code.google.com/p/omnithreadlibr ... loads/list
I've created a simple project :
1 Form with :
- 1 Grid ,
- 1 Datasource,
- 1 MyQuery,
- 1 MyConnection,
- 1 Button.
When clicking on the button I'm executing an SQL Query that is fetching more than 700 000 records (table has about 30 fields). The query is executed inside a thread (very very easy thanks to omnithread). The only thing that I needed to do was a MyQuery.DisableControl / MyQuery.EnableControl.