From a7d2d690720663891b4e26ffc1ebbc108287d8e9 Mon Sep 17 00:00:00 2001 From: Didier Gautheron Date: Tue, 4 May 2021 17:16:46 +0200 Subject: [PATCH] Bug 28287: don't issue more SQL commands after first report SQL error --- reports/guided_reports.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 49dfc95a3e..056b313065 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -824,10 +824,13 @@ elsif ($phase eq 'Run this report'){ my ($sql,$header_types) = $report->prep_report( \@param_names, \@sql_params ); $template->param(header_types => $header_types); my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id ); - my $total = nb_rows($sql) || 0; unless ($sth) { die "execute_query failed to return sth for report $report_id: $sql"; - } else { + } + + my $total = 0; + unless ($errors) { + $total = nb_rows($sql) || 0; my $headers = header_cell_loop($sth); $template->param(header_row => $headers); while (my $row = $sth->fetchrow_arrayref()) { -- 2.11.0