[Dbix-class] Right join
TAPO (Thomas Agersten Poulsen)
TAPO at novozymes.com
Fri Jan 27 16:46:18 CET 2006
Dear Matt,
Thank you for the rapid response.
Unfortunately I still get the left join:
$req->requestedseq()->search_related('response')->count()
gives
SELECT COUNT( * ) FROM requested_seqs me LEFT JOIN responses response ON
( response.requested_sequence = me.id ) WHERE ( request = ? ): 96
Can it be that the auto-loader does not detect the relationship?
It would be great if I could give it a "-join-type"; something like
$req->requestedseq()->search_related('response',{},-join-type=>'right')-
>count()
I tried to use "from":
$req->requestedseq()->search({},{alias=>'res', from =>
[{res=>'response',
-join-type=>'right'},[],{'response.requested_sequence' =>
'res.id'}]})->count()
But that gave the error:
"Can't handle this yet! at .../DBIx/Class/Storage/DBI.pm line 125."
Best regards
Thomas
> -----Original Message-----
> From: dbix-class-bounces at lists.rawmode.org
> [mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of
> Matt S Trout
> Sent: 27. januar 2006 14:38
> To: dbix-class at lists.rawmode.org
> Subject: Re: [Dbix-class] Right join
>
>
> On Fri, Jan 27, 2006 at 11:51:14AM +0100, TAPO (Thomas
> Agersten Poulsen) wrote:
> > Dear list,
> >
> > Please excuse a possibly stupid question---I might be
> doing this all
> > backwards.
> >
> > I am doing a JOIN using DBIx::Class version 0.04999_04
> > to find the number of "requestedseqs" that has a "response":
> >
> > $req->requestedseq()->search({},{join=>'response'})->count()
>
> $req->requestedseq()->search_related('response')->count()
>
> should, I think, do what you mean.
...
>
>
> --
> Matt S Trout Offering custom development,
> consultancy and support
> Technical Director contracts for Catalyst, DBIx::Class
> and BAST. Contact
> Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for
> more information
>
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list