Page 1 of 1

threading?

Posted: Tue 26 May 2009 07:20
by Ludek
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.

Posted: Tue 26 May 2009 07:27
by Ludek
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!

Posted: Wed 27 May 2009 09:02
by Dimon
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.

Posted: Wed 27 May 2009 09:25
by Ludek
ok, i'll try the nonblocking feature. thanks for now :)