OutputData(): Change handover of LastIteration.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-30 19:48:35 +02:00
parent eea296391c
commit 3e73346b20

View file

@ -434,14 +434,13 @@ sub OutputData {
### $LeadIn : print at start of output ### $LeadIn : print at start of output
### $FileTempl: file name template (--filetemplate): filetempl-YYYY-MM ### $FileTempl: file name template (--filetemplate): filetempl-YYYY-MM
### $DBQuery : database query handle with executed query, ### $DBQuery : database query handle with executed query,
### containing $Month, $Key, $Value ### containing $Month, $Key, $Value
### $PadField : padding length for key field (optional) for 'pretty' ### $PadField : padding length for key field (optional) for 'pretty'
### $PadValue : padding length for value field (optional) for 'pretty' ### $PadValue : padding length for value field (optional) for 'pretty'
my ($Format, $Comments, $GroupBy, $Precision, $ValidKeys, $LeadIn, $FileTempl, my ($Format, $Comments, $GroupBy, $Precision, $ValidKeys, $LeadIn, $FileTempl,
$DBQuery, $PadField, $PadValue) = @_; $DBQuery, $PadField, $PadValue) = @_;
my %ValidKeys = %{$ValidKeys} if $ValidKeys; my %ValidKeys = %{$ValidKeys} if $ValidKeys;
my ($FileName, $Handle, $OUT); my ($LastIteration, $FileName, $Handle, $OUT);
our $LastIteration;
# define output types # define output types
my %LegalOutput; my %LegalOutput;
@ -481,7 +480,7 @@ sub OutputData {
$Handle = $OUT; $Handle = $OUT;
}; };
print $Handle &FormatOutput($Format, $Comments, $LeadIn, $Caption, print $Handle &FormatOutput($Format, $Comments, $LeadIn, $Caption,
$Key, $Value, $Precision, $PadField, $PadValue); $Key, $Value, $Precision, $PadField, $PadValue, $LastIteration);
$LastIteration = $Caption; $LastIteration = $Caption;
}; };
close $OUT if ($FileTempl); close $OUT if ($FileTempl);
@ -501,10 +500,8 @@ sub FormatOutput {
### $PadValue : padding length for value field (optional) for 'pretty' ### $PadValue : padding length for value field (optional) for 'pretty'
### OUT: $Output: formatted output ### OUT: $Output: formatted output
my ($Format, $Comments, $LeadIn, $Caption, $Key, $Value, $Precision, $PadField, my ($Format, $Comments, $LeadIn, $Caption, $Key, $Value, $Precision, $PadField,
$PadValue) = @_; $PadValue, $LastIteration) = @_;
my ($Output); my ($Output);
# keep last caption in mind
our ($LastIteration);
# create one line of output # create one line of output
if ($Format eq 'dump') { if ($Format eq 'dump') {
# output as dump (key value) # output as dump (key value)
@ -583,7 +580,7 @@ sub SQLSortOrder {
### IN : $GroupBy: primary sort by 'month' (default) or 'newsgroups' ### IN : $GroupBy: primary sort by 'month' (default) or 'newsgroups'
### $OrderBy: secondary sort by month/newsgroups (default) ### $OrderBy: secondary sort by month/newsgroups (default)
### or number of 'postings' ### or number of 'postings'
### $Type : newsgroup, host, client ### $Type : newsgroup, host or client+version
### OUT: a SQL ORDER BY clause ### OUT: a SQL ORDER BY clause
my ($GroupBy,$OrderBy,$Type) = @_; my ($GroupBy,$OrderBy,$Type) = @_;
my ($GroupSort,$OrderSort) = ('',''); my ($GroupSort,$OrderSort) = ('','');