Re: Optimising FormBuilder database access for linked fields

From: Date: Wed, 08 Feb 2006 19:00:25 +0000
Subject: Re: Optimising FormBuilder database access for linked fields
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22868@lists.php.net to get a copy of this message
On 2/8/06, Anselm Heaton <anselm@netuxo.co.uk> wrote: > Hello, > > When a table is used as a linked field in FormBuilder, the values of interest > are those describied in the linkDisplayFields for that table, and the primary > key. > > However, FormBuilder queries all of the object's fields when creating the form > (I assume it calls DB_DataObject::find and ::fetch which will query all the > fields). At times this can add a certain overhead to the execution time ! > > Does anyone know of a way to get FormBuilder to only query the > linkDisplayFields when used as a linked table ? > > Of course, I could always split my linked table in two (so that one table > contains only the linkDisplayFields and the primary key, with the rest of the > data in another table), however this feels a bit heavy just to optimise > database calls ! (and it wouldn't be normal form). Getting the code to do it > sounds much more sensible ! > As the code stands now it's not easy to implement this as the getDataObjectString() method takes a DO which has already been fetched and it is in this method that the linkDisplayFields are found. This is a good idea, though (in point of fact this should all be done with a join instead of multiple queries, but this is cimplicated...). Go ahead and make a feature request so that this doesn't get lost. -- Justin Patrin

« previous php.pear.general (#22868) next »