[Dbix-class] using functions

Jess Robinson castaway at desert-island.demon.co.uk
Sun Jan 7 00:54:21 GMT 2007



On Sun, 7 Jan 2007, Octavian Rasnita wrote:

> From: "Len Jaffe" <lenjaffe at jaffesystems.com>
>> >  Hi,
>> > 
>> >  I am trying to use the following condition but without success. Is it
>> >  possible to do it with DBIx::Class?
>> > 
>> >  select count(*) where
>> >  substring(title, 1, 4)='XXXX';
>>
>>  select count(*) where title like 'XXXX%'
>
> Oh thanks. I didn't remember about LIKE. It works fine for what I need, but 
> as a future reference, is it possible to use functions like substring with 
> DBIx::Class?
>
> For the moment I have used the "where => ...". Is it the only way?
>

Nope:

->search({ -and => [\"substring(title, 1, 4) = 'XXXX'"]}) ...

Jess




More information about the Dbix-class mailing list