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

Jonas Alves jonas.alves at gmail.com
Tue Jul 22 20:39:06 BST 2008


On Tue, Jul 22, 2008 at 9:14 AM, Moritz Onken <onken at houseofdesign.de> wrote:
>
> Am 21.07.2008 um 15:01 schrieb Eden Cardim:
>
>> On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <onken at houseofdesign.de>
>> wrote:
>>>
>>> But how can I rewrite my query to the other format without writing the
>>> raw
>>> sql where clause?
>>> 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"}
>>>  ]
>>> });

Have you tried the other way around?

-and =>  [
   { '' => \'extract(year from age(NOW(),birthday))'},
   {sex => "male"}
]

I couldn't understand what is the 22 doing there.

-- 
Jonas



More information about the DBIx-Class mailing list