[Dbix-class] Problems using a database function in the where
clause
Eden Cardim
edencardim at gmail.com
Mon Jul 21 14:01:16 BST 2008
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"}
> ]
> });
Because the '=>' operator stringifies it's left operand, thus you'll
end up with some perl internal debug value instead of the string you
intended. What's the problem with writing raw SQL?
--
edenc.vox.com
More information about the DBIx-Class
mailing list