threading?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ludek
Posts: 301
Joined: Thu 12 Oct 2006 09:34

threading?

Post by Ludek » Tue 26 May 2009 07:20

I have some questions for threading with tmsquery:
1. is it safe to bind a tmsquery, which has been executed (.open) in other thread to a datasource and dbgrid? are there some precautions?
2. in which thread are the events like afteropen, beforeopen, afterscroll, oncalcfields etc. executed? in the execution thread or in the main thread?
3. or any other problems? I just have a form, a slow query, datasource and dbgrid, with lots of events set. What do I need to handle? I know about the new connection requirement, is there something more to do?

Thanks, Ludek.
Last edited by Ludek on Tue 26 May 2009 07:29, edited 1 time in total.

Ludek
Posts: 301
Joined: Thu 12 Oct 2006 09:34

Post by Ludek » Tue 26 May 2009 07:27

next questions:

how about cached updates? is it important, which tread calls applyupdates/commitupdates? or is there some rule to do it - i.e. always the thread, that executed the query, always the main thread...?

can i create the tmsquery object in one thread, the tmsconnection in other , open the tmsconnection in third and execute the query in forth thread? or are here some rules present?

thanks for answers!

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 27 May 2009 09:02

If you execute a query in TMSQuery in separated thread then events (like AfterOpen, BeforeOpen) will be called in the execution thread.

To increase the perfomance on opening table you can set the FetchAll property and the NonBlocking option to False. If you use the NonBlocking mode you don't need to use a separated thread. You can find more detailed information about these properties in the SDAC help.

If the NonBlocking mode doesn't solve the problems or any other questions come up, please contact me.

Ludek
Posts: 301
Joined: Thu 12 Oct 2006 09:34

Post by Ludek » Wed 27 May 2009 09:25

ok, i'll try the nonblocking feature. thanks for now :)

Post Reply