return unless $fin_idx;
$fin = ( keys %$fin_idx == 1 ) ? (values %$fin_idx)[0] : {
- -or => [ map
- { ref $fin_idx->{$_} eq 'HASH' ? %{$fin_idx->{$_}} : $fin_idx->{$_} }
- sort keys %$fin_idx
- ]
+ -or => [ map {
+ # unroll single-element hashes
+ ( ref $fin_idx->{$_} eq 'HASH' and keys %{$fin_idx->{$_}} == 1 )
+ ? %{$fin_idx->{$_}}
+ : $fin_idx->{$_}
+ } sort keys %$fin_idx ]
};
}
else {
) ),
{
+ where => { -or => [ -and => [ foo => { '!=', undef }, bar => { -in => [ 69, 42 ] } ], foo => { '=', { -value => undef } } ] },
+ sql => 'WHERE ( foo IS NOT NULL AND bar IN ( ?, ? ) ) OR foo IS NULL',
+ collapsed_sql => 'WHERE foo IS NULL OR ( bar IN ( ?, ? ) AND foo IS NOT NULL )',
+ cc_result => { -or => [
+ foo => undef,
+ { bar => { -in => [ 69, 42 ] }, foo => { '!=', undef } }
+ ] },
+ efcc_result => {},
+ },
+ {
where => { -or => [ rank => { '=' => \13 }, charfield => { '=' => undef }, artistid => { '=' => 1 }, genreid => { '=' => \['?', 2] } ] },
sql => 'WHERE rank = 13 OR charfield IS NULL OR artistid = ? OR genreid = ?',
collapsed_sql => 'WHERE artistid = ? OR charfield IS NULL OR genreid = ? OR rank = 13',