[Dbix-class] How to write this condition in DBIC?

Marc Mims marc at questright.com
Fri Oct 12 16:48:03 GMT 2007


* Oleg Pronin <syber.rus at gmail.com> [071012 08:40]:
> SELECT * FROM table WHERE lower(field) = ?

  my $cond = "lower(field)=$value";
  $rs->search({}, { where => \$cond });

If you don't have quoting on, you can do:

  $rs->search({ 'lower(field)' => $value });

There seems to be a bug in DBD::SQLite; using placeholders on the left
side of a comparison doesn't work for there.

	-Marc



More information about the DBIx-Class mailing list