in reply to Elegant way to turn array of values into SQL "where" clause
What about:
$WHERE = join ' OR ', map { X => $_ }, @ARRAY; $DB->update( { table => 'table', fields => { Y => 0 }, where => $WHERE } );
Update: Bugs always appear *after* posting :). [...] I misunderstood DBIx::Abstract documentation. Here's my next attempt. It's a bit more complicated though. Fill @WHERE with enough 'OR's and then place the hashrefs over the even elements:
my @ARRAY=qw/foo bar baz/; my @WHERE=('OR') x (2*@ARRAY - 1); for (0 .. $#ARRAY) { $WHERE[2*$_] = { X => $ARRAY[$_] }; }
--
David Serrano
|
|---|