Using MyQuery in Threads

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SARTrack
Posts: 2
Joined: Fri 06 Sep 2013 06:31

Using MyQuery in Threads

Post by SARTrack » Fri 06 Sep 2013 06:40

I have a system which has to update several Tables up to 10 times a second.

For this I have several Forms:
The 'main' SQL form, which has MyConnection on it.
Then 3 other Forms, which each have up to 3 MyQuery's on them.

They now all run in the main thread. This is causing major delay's in the User interface.
I need to put all this 'background' SQL trafic in threads.

- Can this be done, and how?
- Can a MyQuery access a MyConnection which is in the Main Thread?
- Does anybody have some example code on how to achieve what I need?

Thanks,

Bart Kindt
Developer SARTrack Search and Rescue software.
www.sartrack.co.nz

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Using MyQuery in Threads

Post by DemetrionQ » Fri 06 Sep 2013 11:36

Hello.

The right way to work in a multithreaded application is to have connection (the TMyConnection component) in each thread. You can have infinite amount of queries running through one connection in one thread, but you should not run several queries from several threads through one connection.

Post Reply