[Dbix-class] Thoughts about "complex" searches.
Jesper Krogh
jesper at krogh.cc
Wed Dec 7 06:36:35 CET 2005
Matt S Trout wrote:
> On Wed, Dec 07, 2005 at 12:13:14AM +0100, David Kamholz wrote:
>
>>You should be able to do:
>>
>>my $rs = Track->search({ 'artist.birth' => { '<', $date } }, { join
>>=> 'artist' });
>>
>>Where 'artist' is the name of the relationship in the Track class.
>
>
> and add prefetch => 'artist' to the attr hash and it'll JOIN across the
> relationship to the artist table and your $track objects will come with
> $track->artist pre-populated.
Thanks a lot. I did suspect that I've missed something.
> If you got told to use a view then I suspect either your explanation
> of the query didn't come across clearly or quicksilver hadn't had enough
> coffee yet ...
Thats most likely my explanation that lacked.
Jesper
--
Jesper Krogh, jesper at krogh.cc, JabberID: jesper at jabbernet.dk
More information about the Dbix-class
mailing list