Fix comments and code in clisverstats.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-16 21:00:08 +02:00
parent 28157570f1
commit 0ee389fc42

View file

@ -86,7 +86,7 @@ elsif ($OptType eq 'host') {
### init database ### init database
my $DBHandle = InitDB(\%Conf,1); my $DBHandle = InitDB(\%Conf,1);
### get time period and newsgroups, prepare SQL 'WHERE' clause ### get time period and names, prepare SQL 'WHERE' clause
# get time period # get time period
# and set caption for output and expression for SQL 'WHERE' clause # and set caption for output and expression for SQL 'WHERE' clause
my ($CaptionPeriod,$SQLWherePeriod) = &GetTimePeriod($OptMonth); my ($CaptionPeriod,$SQLWherePeriod) = &GetTimePeriod($OptMonth);
@ -94,7 +94,7 @@ my ($CaptionPeriod,$SQLWherePeriod) = &GetTimePeriod($OptMonth);
&Bleat(2,"--month option has an invalid format - ". &Bleat(2,"--month option has an invalid format - ".
"please use 'YYYY-MM', 'YYYY-MM:YYYY-MM' or 'ALL'!") if !$CaptionPeriod; "please use 'YYYY-MM', 'YYYY-MM:YYYY-MM' or 'ALL'!") if !$CaptionPeriod;
# get list of hosts and set expression for SQL 'WHERE' clause # get list of hosts and set expression for SQL 'WHERE' clause
# with placeholders as well as a list of newsgroup to bind to them # with placeholders as well as a list of names to bind to them
my ($SQLWhereNames,@SQLBindNames); my ($SQLWhereNames,@SQLBindNames);
if ($OptNames) { if ($OptNames) {
($SQLWhereNames,@SQLBindNames) = &SQLGroupList($OptNames,$OptType); ($SQLWhereNames,@SQLBindNames) = &SQLGroupList($OptNames,$OptType);
@ -138,7 +138,7 @@ if ($OptReportType and $OptReportType ne 'default') {
$SQLSelect = "month,$OptType,postings"; $SQLSelect = "month,$OptType,postings";
}; };
### get length of longest newsgroup name delivered by query ### get length of longest name delivered by query
### for formatting purposes ### for formatting purposes
my $Field = ($GroupBy eq 'month') ? $OptType : 'month'; my $Field = ($GroupBy eq 'month') ? $OptType : 'month';
my ($MaxLength,$MaxValLength) = &GetMaxLength($DBHandle,$Conf{'DBTable'}, my ($MaxLength,$MaxValLength) = &GetMaxLength($DBHandle,$Conf{'DBTable'},
@ -155,7 +155,7 @@ $DBQuery = $DBHandle->prepare(sprintf('SELECT %s FROM %s.%s %s %s %s',
$SQLOrderClause)); $SQLOrderClause));
# execute query # execute query
$DBQuery->execute(@SQLBindNames) $DBQuery->execute(@SQLBindNames)
or &Bleat(2,sprintf("Can't get %ss data for %s from %s.%s: %s\n", or &Bleat(2,sprintf("Can't get %s data for %s from %s.%s: %s\n",
$OptType,$CaptionPeriod,$Conf{'DBDatabase'},$Conf{'DBTable'}, $OptType,$CaptionPeriod,$Conf{'DBDatabase'},$Conf{'DBTable'},
$DBI::errstr)); $DBI::errstr));