From d8643908a7d6243c361e670573af763067db408d Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 16 Jan 2013 19:05:22 +0100 Subject: Bug 819432: Execute queries in two steps to improve performance r=dkl a=LpSolit --- whine.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'whine.pl') diff --git a/whine.pl b/whine.pl index 481b47425..f7ed6d5c7 100755 --- a/whine.pl +++ b/whine.pl @@ -453,7 +453,7 @@ sub run_queries { 'order' => \@orderstrings ); # If a query fails for whatever reason, it shouldn't kill the script. - my $sqlquery = eval { $search->sql }; + my $data = eval { $search->data }; if ($@) { print STDERR get_text('whine_query_failed', { query_name => $thisquery->{'name'}, author => $args->{'author'}, @@ -461,15 +461,12 @@ sub run_queries { next; } - $sth = $dbh->prepare($sqlquery); - $sth->execute; - - while (my @row = $sth->fetchrow_array) { + foreach my $row (@$data) { my $bug = {}; for my $field (@searchfields) { my $fieldname = $field; $fieldname =~ s/^bugs\.//; # No need for bugs.whatever - $bug->{$fieldname} = shift @row; + $bug->{$fieldname} = shift @$row; } if ($thisquery->{'onemailperbug'}) { -- cgit v1.2.3-24-g4f1b