[Dbix-class] Re: Problems using a database function in the where clause

Aristotle Pagaltzis pagaltzis at gmx.de
Mon Jul 21 17:48:53 BST 2008


* Eden Cardim <edencardim at gmail.com> [2008-07-21 15:10]:
> On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <onken at houseofdesign.de> wrote:
> > Why is it not possible to write my query with as scalar ref:
> >
> > $rs->search({
> >  -and =>
> >    [
> >     {\"extract(year from age(NOW(),birthday))" => 22},
> >     {sex => "male"}
> >    ]
> > });
> 
> Because the '=>' operator stringifies it's left operand,

No, it never ever does that. The only thing it will do is
automatically quote a bareword – nothing more.

> thus you'll end up with some perl internal debug value instead
> of the string you intended.

That’s because hashes stringify their keys, not because of the
fat comma.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the DBIx-Class mailing list