[Catalyst] has_many but no left join?!

Francisco Obispo fobispo at isc.org
Tue Jun 18 18:35:06 GMT 2013


Prefetch is really smart, and in the newer versions of DBIx::Class is even capable of taking multiple relations without the risk of duplicating rows.

  http://search.cpan.org/~frew/DBIx-Class-0.08205/lib/DBIx/Class/ResultSet.pm#prefetch

Basically as I understood the problem, you want to fetch a row, and the "possible" relation, as a LEFT JOIN would provide. But you always want the main relation to return a value even if the join is NULL.

Prefetch will do that without complicated use cases.

Francisco


On Jun 18, 2013, at 11:19 AM, Stephen Shorrock <stephen.shorrock at gmail.com> wrote:

> I think Robert has cracked it, but why prefetch?
> 
> 

Francisco Obispo 
Director of Applications and Services - ISC
email: fobispo at isc.org
Phone: +1 650 423 1374 || INOC-DBA *3557* NOC
PGP KeyID = B38DB1BE




More information about the Catalyst mailing list