Flesh groups on search (was Re: [CDBI] Re: Make CDBI go fast)

Michael G Schwern <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Edward J. Sabol wrote:
>> * Allow searches to pre-flesh out column groups (so it takes 1 query
>> instead of N)
>>
>> Right now, searches will only fetch the essential columns in its
>> query. Then if you use a non-essential column it must do another
>> query for each object. For lots of objects with several groups this
>> can get expensive. It would be handy if there was a syntax like:
>>
>>     my @objects = CDBI->search( col => 42, { flesh_out => \@groups } );
>>
>> Which, in one query, will select the columns in the essential group
>> and any additional columns in the given @groups.
> 
> Honestly, this doesn't sound all that useful, but I don't see the harm, I
> guess. Personally, I would just put these other columns in the Essential
> group in the first place.

That's static.  It requires you know beforehand how every object in your class is going to be used and that its going to be used the same way every time everywhere by everyone.


> But, it would be handy to be able to override the essential group in
> some cases -- I'd probably just like to be able to specify the
> columns.

I hadn't considered that.  If I make the key something like "flesh_out_groups" that leaves room for "flesh_out_columns".  In fact fleshing out by column might be more useful for my purposes.


> What about retrieve()? Similar support for 'flesh_out' there as well?

I haven't considered it, but it sounds like an ok idea.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.