[Dbix-class] wishlist: "might_have_many"

Hartmaier Alexander Alexander.Hartmaier at t-systems.at
Thu Apr 13 13:31:47 CEST 2006


> -----Original Message-----
> From: dbix-class-bounces at lists.rawmode.org [mailto:dbix-class-
> bounces at lists.rawmode.org] On Behalf Of Mike Rylander
> Sent: Thursday, April 13, 2006 4:53 AM
> To: dbix-class at lists.rawmode.org
> Subject: Re: [Dbix-class] wishlist: "might_have_many"
> 
> On 4/12/06, Mark Hedges <hedges at ucsd.edu> wrote:
> >
> > I found that if I do a prefetch on a Foo RS to its have_many
> > Bar, but it doesn't have any Bars, I don't get the Foo at all.
> >
> > This is similar to a problem where if I do a prefetch from one
> > to another with a 1:1 relationship, but the other doesn't exist,
> > it does not work if I defined with has_one but it does work if I
> > defined if might_have.
> >
> > However there isn't a fix for a 1:N relationship.  (Doesn't 1:N
> > imply that N could equal 0?)  Instead I have to remember where
> > this drop might occur and I get no object, and I can't prefetch.
> >
> 
> Sounds like has_many should use LEFT JOIN ... [he says, sniping from
> the sidelines having not looked at the code]
> 
> --
> Mike Rylander

I talked to castaway yesterday in IRC about changing the default join type for has_many to left join to prevent such things.
What do you think about such a change?

Till then I specify the join type myself for each rel I need a non-default value.

-Alex

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH
Rennweg 97-99, 1030 Wien
Telefon +43 (0)57057 0, Telefax +43 (0)57057 8155
Bank Austria AG, BLZ 12000, Kto. 233-111-674/00, IBAN AT291200023311167400
Handelsgericht Wien, FN 79340b – DVR Nr. 0713520 – ARA-Lizenz Nr. 12554
ATU 15169001

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Hinweis: Dieses E-mail kann vertrauliche und geschuetzte Informationen enthalten.
Sollten Sie nicht der beabsichtigte Empfaenger sein, verstaendigen Sie bitte den Absender und loeschen Sie dieses E-mail dann sofort.

Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*


More information about the Dbix-class mailing list