diff options
author | Olivier Thauvin <nanardon@mageia.org> | 2010-09-27 11:50:03 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mageia.org> | 2010-09-27 11:50:03 +0000 |
commit | 6f42c4ffb976cdffa257a09e4dcb33119750abfc (patch) | |
tree | 92a64502c15673eb04529d122ed64fc319d8d6e7 /lib/MGA | |
parent | 7c16f1d36bd584c36f187bd0401fb39e94771765 (diff) | |
download | mgamirrors-6f42c4ffb976cdffa257a09e4dcb33119750abfc.tar mgamirrors-6f42c4ffb976cdffa257a09e4dcb33119750abfc.tar.gz mgamirrors-6f42c4ffb976cdffa257a09e4dcb33119750abfc.tar.bz2 mgamirrors-6f42c4ffb976cdffa257a09e4dcb33119750abfc.tar.xz mgamirrors-6f42c4ffb976cdffa257a09e4dcb33119750abfc.zip |
- allow search on multiple values
Diffstat (limited to 'lib/MGA')
-rw-r--r-- | lib/MGA/Mirrors/DB.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/MGA/Mirrors/DB.pm b/lib/MGA/Mirrors/DB.pm index 78b6862..5ff0649 100644 --- a/lib/MGA/Mirrors/DB.pm +++ b/lib/MGA/Mirrors/DB.pm @@ -191,14 +191,14 @@ sub find_mirrors { country => 'countries.code', continent => 'countries.contienent_code', }->{$_}) { - push(@mw, sprintf('%s = ?', $field)); - push(@mvals, $filters->{$_}); + push(@mw, sprintf('%s = any(?)', $field)); + push(@mvals, ref $filters->{$_} ? $filters->{$_} : [ $filters->{$_} ]); } if (my $field = { protocol => 'protocol', }->{$_}) { - push(@uw, sprintf('%s = ?', $field)); - push(@uvals, $filters->{$_}); + push(@uw, sprintf('%s = any(?)', $field)); + push(@uvals, ref $filters->{$_} ? $filters->{$_} : [ $filters->{$_} ]); } } } @@ -228,8 +228,8 @@ sub _find_urls { protocol => 'urls.protocol', }->{$_} or next; - push(@w, sprintf('%s = ?', $field)); - push(@vals, $filters->{$_}); + push(@w, sprintf('%s = any(?)', $field)); + push(@vals, ref $filters->{$_} ? $filters->{$_} : [ $filters->{$_} ]); } $query .= join(' and ', @w); } |