Master - Detail using TMyTable

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Gary Wiederhold
Posts: 2
Joined: Fri 14 Nov 2008 02:28

Master - Detail using TMyTable

Post by Gary Wiederhold » Fri 14 Nov 2008 02:51

When I open a child form containing two TMyTables set up as a Master Detail using the MasterSource and MasterFields properties, the form takes a long time to open. The SQL in the master is "select * from x_areas where JobID = :ijparam" and the SQL in the detail is "select * from x_items where Remove = 0". If I use DBMonitor to look at what gets run I see that a query getting all the data from the detail is running "select * from x_items", which takes awhile to run about 36 seconds. Once this finishes I then see the select from the master and then the select from the detail based upon the fields in the MasterFields property.
From the information in your forums it acts like this because MySQL does not use cursors so it has to get all the data out of the table. Is this statement correct? Is there any way around this? Is there any way I can force it to only get a subset of the table? Say select * from x_items where Remove = 0 and Job_ID = :iparam instead of the whole table? This is a big table.

And would connection pooling speed up my get here as well?

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Fri 14 Nov 2008 06:53

Which MyDac version are you using ?

Gary Wiederhold
Posts: 2
Joined: Fri 14 Nov 2008 02:28

Version of MyDAC

Post by Gary Wiederhold » Sat 15 Nov 2008 14:00

MyDAC version 5.10.0.10 for Delphi 7.

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Sat 15 Nov 2008 19:08

You should try a newer version of MyDAC. I know that devart did bug fixes and enhancement on this since (5.20 branch, 5.50 branch). You should test your project with a newer version. If 'm not wrong the 5.70 branch looks to be the last one.

Ps : be aware of this, in version prior to 5.50 parameters were refreshed on all cases. Starting from 5.50 this is no more the case, you should add this : DBAccess.RefreshParamsOnInsert:=true;

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

Re: Master - Detail using TMyTable

Post by Dimon » Mon 17 Nov 2008 08:33

Gary Wiederhold wrote:From the information in your forums it acts like this because MySQL does not use cursors so it has to get all the data out of the table. Is this statement correct? Is there any way around this? Is there any way I can force it to only get a subset of the table? Say select * from x_items where Remove = 0 and Job_ID = :iparam instead of the whole table? This is a big table.
If you use master/detail relationship between tables, TMyTable should get only data that is connected with master record.
Please check if the latest MyDAC build solves the problem.

Post Reply