Page 1 of 1

Master - Detail using TMyTable

Posted: Fri 14 Nov 2008 02:51
by Gary Wiederhold
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?

Posted: Fri 14 Nov 2008 06:53
by swierzbicki
Which MyDac version are you using ?

Version of MyDAC

Posted: Sat 15 Nov 2008 14:00
by Gary Wiederhold
MyDAC version 5.10.0.10 for Delphi 7.

Posted: Sat 15 Nov 2008 19:08
by swierzbicki
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;

Re: Master - Detail using TMyTable

Posted: Mon 17 Nov 2008 08:33
by Dimon
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.