On Wed, Oct 16, 2013 at 08:13:34PM -0400, Rob Kinyon wrote:
> It's good you showed all the code because the extended comparison in a
> join relationship isn't possible. (It's one of ribasushi's many
> in-progress branches. Patches most definitely welcome here.)
>
> However, this is definitely possible in a search. You have to use the
> trapdoor.
>
> ->search({ 1 => \"me.field_x - me.field_y" });
>
> That is a reference to a string.
A ha, so we drop down to literal SQL (via the scalar reference), but we
can't do that in a join because we can't jam the $args->{foreign_alias}
bits into the reference - it's then no longer literal SQL.
thanks! looks like generating a new column to hold the value of the
arithmetic operation is indeed the right way to go (and I've already done
it, in the time it took for the mail to turn around). ;)
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]