$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 fetches all males who are 22 years old (postgresql syntax).


But when you're using db-specifc stuff nobody';s written general support
for, a small chunk of raw SQL that solves the problem, encapsulated in
a method on your resultset, is just fine.

The problem is that I create this query dynamically. It is much easier to push all the restrictions in an array and pass that array to search() than creating the raw
sql from that array.

But If there is no way to solve this with dbic I'll just write plain sql.

thanks so far,



moritz

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to