From f7d287294b615166d205f4cdfee15f9d2923c441 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 27 Aug 2020 19:11:37 +0100 Subject: [PATCH] sg-report-flight: Refactor runvar access Collect the runvars query into local perl variables. This will allow us to reuse the information without going back to the db. No functional change. Signed-off-by: Ian Jackson --- sg-report-flight | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sg-report-flight b/sg-report-flight index 0783458..281361c 100755 --- a/sg-report-flight +++ b/sg-report-flight @@ -1142,6 +1142,16 @@ END my $ji = $htmlout_jobq->fetchrow_hashref(); die unless $ji; + my $varsq= db_prepare(<execute($fi->{Flight}, $job); + my $runvar_table = $varsq->fetchall_arrayref({}); + my %runvar_map; + $runvar_map{$_->{name}} = $_ foreach @$runvar_table; + print H <$title @@ -1244,14 +1254,8 @@ END

Test control variables

END - my $varsq= db_prepare(<execute($fi->{Flight}, $job); - while (my $varrow= $varsq->fetchrow_arrayref()) { - my ($vn,$vv,$synth) = (@$varrow); + foreach my $varrow (@$runvar_table) { + my ($vn,$vv,$synth) = (@$varrow{qw(name val synth)}); print H ""; print H "
NameValueSource
".encode_entities($vn).""; my $url; -- 2.39.5