From 6f42c4ffb976cdffa257a09e4dcb33119750abfc Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Mon, 27 Sep 2010 11:50:03 +0000 Subject: - allow search on multiple values --- lib/MGA/Mirrors/DB.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/MGA') 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); } -- cgit v1.2.1