[Dbix-class] [PATCH] allow non-columns to be passed in joinsusing the from a

mike pulsation at gmail.com
Thu Sep 21 02:21:58 CEST 2006


On 9/20/06, Robert Dobbs <bobisdobbs at hotmail.com> wrote:
> >From: mike <pulsation at gmail.com>
> >Date: Wed, 20 Sep 2006 18:22:42 -0500
> >
> >   LEFT JOIN `authorizations` `authorizations` ON (
> >`authorizations`.`product_id` = `me`.`product_id` AND
> >`authorizations.active` = 1 )
> >
> >the affected part is the second condition for the JOIN.  without this
> >patch, the 1 is quoted as `1`, which is undesired.  with the patch,
> >passing the 1 as a scalar reference allows it to be passed unquoted.
> >the associated search construct is:
> >
> >$rs->search
> >(
> >     {
> >         'me.publisher_id'                   => $publisher->id,
> >         'me.active'                         => 1,
> >         'authorizations.authorization_id'   => undef
> >     },
>
> Isn't it supposed to figure out on its own whether to quote or not based on
> the field type in the schema?

quoting with backticks in mysql designates the enclosed value as an
identifier; thus, quoting the value in this example with a backtick,
regardless of field type, would be incorrect behavior.

i am fairly certain that the "don't quote if scalar ref" behavior that
is supported for where conditions simply isn't implemented for
join_condition due to lack of usage.  most are likely to not be using
the custom from stuff for joins not directly comparing two columns.

but i could be wrong.

-mike



More information about the Dbix-class mailing list