[Dbix-class] ping 'from' attribute doc author: you need to fix them

Brandon Black blblack at gmail.com
Wed May 10 22:18:53 CEST 2006


On 5/10/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> C<join> will usually do what you need and it is strongly recommended
> that you
> avoid using C<from> unless you cannot achieve the desired result using
> C<join>.
> And we really do mean "cannot", not just tried and failed. Attempting to use
> this because you're having problems with C<join> is like trying to use x86
> ASM because you've got a syntax error in your C. Trust us on this.
>
> Now, if you're still really, really sure you need to use this (and if you're
> not 100% sure, ask the mailing list first), here's an explanation of how
> this
> works.
>
> The syntax is as follows -
>
>    [
>      { <alias1> => <table1> },
>      [
>        { <alias2> => <table2>, -join_type => 'inner|left|right' },
>        [], # nested JOIN (optional)
>        { <table1.column1> => <table2.column2>, ... (more conditions) },
>      ],
>      # More of the above [ ] may follow for additional joins
>    ]
>
>    <table1> <alias1>
>    JOIN
>      <table2> <alias2>
>      [JOIN ...]
>    ON <table1.column1> = <table2.column2>
>    <more joins may follow>
>
>
> If people can look over that and verify that it (a) makes sense, and (b)
> is actually right, I'll commit that and it'll go out in the next release.
>

Did you mean to put parentheses on the indented joins in sql version
of that example, or not?  I have some rather complex cases of "FROM
foo JOIN (bar LEFT JOIN baz ON (x = y)) ON (a = b) JOIN baz ON (m =
n)" type stuff, which I think of as "nested joins" in SQL.  I only
ever do complex stuff in PostgreSQL, so far all I know I'm using
Pg-isms when I do that.  Or is that that the parens are
uneccesary/optional in most SQL dialects?

-- Brandon



More information about the Dbix-class mailing list