X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=blobdiff_plain;f=groupstats.pl;h=84105cf2e39f6012b3ee75d50c67f76f9e1ae512;hp=f0e42781c7c7304b6818468cef117ac16c0edf47;hb=25b25735dddfe027afe565a2e2ec78490a2cfa5e;hpb=3f817eb4289da08fff2aab19db97a82d977b8e3e diff --git a/groupstats.pl b/groupstats.pl index f0e4278..84105cf 100755 --- a/groupstats.pl +++ b/groupstats.pl @@ -100,8 +100,13 @@ my ($CaptionPeriod,$SQLWherePeriod) = &GetTimePeriod($OptMonth); "please use 'YYYY-MM', 'YYYY-MM:YYYY-MM' or 'ALL'!") if !$CaptionPeriod; # get list of newsgroups and set expression for SQL 'WHERE' clause # with placeholders as well as a list of newsgroup to bind to them -my ($SQLWhereNewsgroups,@SQLBindNewsgroups) = &SQLGroupList($OptNewsgroups) - if $OptNewsgroups;; +my ($SQLWhereNewsgroups,@SQLBindNewsgroups); +if ($OptNewsgroups) { + ($SQLWhereNewsgroups,@SQLBindNewsgroups) = &SQLGroupList($OptNewsgroups); + # bail out if --newsgroups is invalid + &Bleat(2,"--newsgroups option has an invalid format!") + if !$SQLWhereNewsgroups; +} ### build SQL WHERE clause (and HAVING clause, if needed) my ($SQLWhereClause,$SQLHavingClause); @@ -155,9 +160,10 @@ if ($OptReportType and $OptReportType ne 'default') { ### get length of longest newsgroup name delivered by query ### for formatting purposes my $Field = ($GroupBy eq 'month') ? 'newsgroup' : 'month'; -my $MaxLength = &GetMaxLength($DBHandle,$Conf{'DBTableGrps'}, - $Field,$SQLWhereClause,$SQLHavingClause, - @SQLBindNewsgroups); +my ($MaxLength,$MaxValLength) = &GetMaxLength($DBHandle,$Conf{'DBTableGrps'}, + $Field,'postings',$SQLWhereClause, + $SQLHavingClause, + @SQLBindNewsgroups); ### build and execute SQL query my ($DBQuery); @@ -194,8 +200,8 @@ if ($OptBoundType and $OptBoundType ne 'default') { $DBQuery = $DBHandle->prepare(sprintf('SELECT %s FROM %s.%s %s %s %s', $SQLSelect, $Conf{'DBDatabase'},$Conf{'DBTableGrps'}, - $SQLWhereClause,$SQLGroupClause,$ - SQLOrderClause)); + $SQLWhereClause,$SQLGroupClause, + $SQLOrderClause)); # execute query $DBQuery->execute(@SQLBindNewsgroups) @@ -242,7 +248,7 @@ if ($OptCaptions && $OptComments) { # output data &OutputData($OptFormat,$OptComments,$GroupBy,$Precision, $OptCheckgroupsFile ? $ValidGroups : '', - $OptFileTemplate,$DBQuery,$MaxLength); + $OptFileTemplate,$DBQuery,$MaxLength,$MaxValLength); ### close handles $DBHandle->disconnect; @@ -373,6 +379,9 @@ Restrict output to those newgroups present in a file in checkgroups format (one newgroup name per line; everything after the first whitespace on each line is ignored). All other newsgroups will be removed from output. +Contrary to B, I is not a template, but refers to +a single file in checkgroups format. + =item B<-r>, B<--report> I Choose the report type: I, I or I @@ -430,8 +439,8 @@ you'll get the following result: de.comp.datenbanken.misc has not been considered even though it has 38 postings in total, because it has less than 25 postings in every single -month. If you want to list all newsgroups with more than 25 postings U, you'll have to set the boundary type to I, see below. +month. If you want to list all newsgroups with more than 25 postings +I, you'll have to set the boundary type to I, see below. A boundary type of I will show only those newsgroups - at all - that satisfy the boundaries in each and every single month. With the above @@ -443,10 +452,10 @@ you'll get this result: de.comp.datenbanken.ms-access 293 de.comp.datenbanken.mysql has not been considered because it had less than -25 postings in 2012-02. +25 postings in 2012-02 (only). You can use that to get a list of newsgroups that have more (or less) then -x postings during the whole reporting period. +x postings in every month during the whole reporting period. A boundary type of I will show only those newsgroups - at all -that satisfy the boundaries on average. With the above list of newsgroups and