Page 1 of 1

query progress/feedback

Posted: Sun 01 Jul 2007 12:02
by sandy771
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

Posted: Tue 03 Jul 2007 08:15
by Antaeus
Now MyDAC can not execute queries in the way you have described. We are considering a possibility to add such functionality in one of the next MyDAC build or version.

Posted: Thu 29 Jan 2009 20:34
by eimix
Hi,

are any updates on this issue?
i also need such functionality, and i do not like to mess with threads my self :roll:

Thanks, eimix

Posted: Thu 05 Feb 2009 09:05
by Dimon
To solve this problem you can use FetchAll = False mode.

Posted: Thu 05 Feb 2009 09:10
by eimix
Fetch all does nothing special - becouse my Query Execution takes eg. 12seconds, data fetching 0.5seconds (~10000 records)

Posted: Mon 09 Feb 2009 15:18
by Dimon
Now MyDAC does not provide such functionality.

Posted: Mon 09 Feb 2009 21:14
by eimix
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 :(

Posted: Tue 10 Feb 2009 15:42
by swierzbicki
Hi eimix,

I've just discovered this great library today : OmniThreadLibrary

Quoted from their website :
What is OmniThreadLibrary?

OmniThreadLibrary is a simple to use threading library for Delphi. OTL's main "selling" points (besides the prices, of course ;) are 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.
Faq : http://otl.17slon.com/faq.htm
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.