Re: [CDBI] quantity of DB queries

Mike Whitaker <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On 28 Jul 2006, at 10:32, Oliver Jeeves wrote:

> I'm concerned about the number of queries Class::DBI would need to  
> make to a database. My understanding is that if I were to do  
> something like this:
>
> my $obj = My::DB::Thing->retrieve(1);
> my $some_value = $obj->fk->value

[ snip ]
> To clarify, in the above example, I would expect the following DB  
> queries:
>
> Look up all values for row in thing table.
> Look up all values for row in table referenced by fk.

When CDBI does a retrieve, or analogous operation, it only retrieves  
the ESSENTIAL columns. You can change which these are by doing:

$class->columns(Essential => $class->columns);

or similar.
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.