[CDBI] quantity of DB queries

Oliver Jeeves <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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;

Then CDBI would be doing something like the following:

Look up primary key values for row in Thing table
Look up fk value in Thing table for previously fetched primary keys
Look up primary key values for row in whatever table fk represents
Look up value in the fk table

Is that correct?

The trouble is, for a web application, I generally want to get something 
from the database, and then just work with those values without having 
to go back to the DB unless I need to look up a foreign key in another 
table. Does CDBI allow me to do this?

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