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

2008-07-24 Thread Matt S Trout
On Wed, Jul 23, 2008 at 09:24:17AM +0200, Moritz Onken wrote: > > > > $rs->search({ > -and => > [ > {\"extract(year from age(NOW(),birthday))" => 22}, > {sex => "male"} > ] > }); > > > >Have you tried the other way around? > > > >-and => [ > > { '' => \'ex

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

2008-07-23 Thread Jason Gottshall
Moritz Onken wrote: $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.

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

2008-07-23 Thread Moritz Onken
$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. This query fetche

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

2008-07-22 Thread Matt S Trout
On Tue, Jul 22, 2008 at 09:14:15AM +0200, Moritz Onken wrote: > > Am 21.07.2008 um 15:01 schrieb Eden Cardim: > > >On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken > ><[EMAIL PROTECTED]> wrote: > >>But how can I rewrite my query to the other format without writing > >>the raw > >>sql where claus

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

2008-07-22 Thread Jonas Alves
On Tue, Jul 22, 2008 at 9:14 AM, Moritz Onken <[EMAIL PROTECTED]> wrote: > > Am 21.07.2008 um 15:01 schrieb Eden Cardim: > >> On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <[EMAIL PROTECTED]> >> wrote: >>> >>> But how can I rewrite my query to the other format without writing the >>> raw >>> sql wh

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

2008-07-22 Thread Moritz Onken
Am 21.07.2008 um 15:01 schrieb Eden Cardim: On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <[EMAIL PROTECTED]> 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

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

2008-07-21 Thread Eden Cardim
On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <[EMAIL PROTECTED]> 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

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

2008-07-21 Thread Moritz Onken
Hi, referring to > http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Manual/Cookbook.pod#Using_SQL_functions_on_the_left_hand_side_of_a_comparison I tried to run this query: $rs->search({ -and => [ {"extract(year from age(NOW(),birthday))" => 22}, {sex => "male"}