Fix version queries.
Add month to WHERE clause, use bind values. Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
07e4543717
commit
d02ae5e2ff
|
@ -215,10 +215,14 @@ while (my ($Month, $Key, $Value) = $DBQuery->fetchrow_array) {
|
||||||
# output client versions
|
# output client versions
|
||||||
if ($OptVersions) {
|
if ($OptVersions) {
|
||||||
### get client versions
|
### get client versions
|
||||||
# $SQLWhereClause without 'ALL' version
|
# $SQLWhereClause without 'ALL' version, with client and month set
|
||||||
$SQLWhereClause = SQLBuildClause('where',$SQLWherePeriod,$SQLWhereNames,
|
$SQLWhereClause = SQLBuildClause('where',$SQLWherePeriod,$SQLWhereNames,
|
||||||
$ExcludeSums,"version != 'ALL'","client = '$Client'",
|
$ExcludeSums,"version != 'ALL'",
|
||||||
|
'client = ?','month = ?',
|
||||||
&SQLSetBounds('default',$LowBound,$UppBound));
|
&SQLSetBounds('default',$LowBound,$UppBound));
|
||||||
|
# push client and month to @SQLVersBindNames
|
||||||
|
my @SQLVersBindNames = @SQLBindNames;
|
||||||
|
push (@SQLVersBindNames, ($Client, $Month));
|
||||||
|
|
||||||
# save length of longest client
|
# save length of longest client
|
||||||
my $ClientMaxLenght = $MaxLength;
|
my $ClientMaxLenght = $MaxLength;
|
||||||
|
@ -227,7 +231,7 @@ while (my ($Month, $Key, $Value) = $DBQuery->fetchrow_array) {
|
||||||
# for formatting purposes
|
# for formatting purposes
|
||||||
my ($MaxLength,$MaxValLength) = &GetMaxLength($DBHandle,$Conf{'DBTable'},
|
my ($MaxLength,$MaxValLength) = &GetMaxLength($DBHandle,$Conf{'DBTable'},
|
||||||
'version','postings',$SQLWhereClause,
|
'version','postings',$SQLWhereClause,
|
||||||
'',@SQLBindNames);
|
'',@SQLVersBindNames);
|
||||||
if ($MaxLength) {
|
if ($MaxLength) {
|
||||||
# add lenght of '- '
|
# add lenght of '- '
|
||||||
$MaxLength += 2;
|
$MaxLength += 2;
|
||||||
|
@ -242,7 +246,7 @@ while (my ($Month, $Key, $Value) = $DBQuery->fetchrow_array) {
|
||||||
$SQLWhereClause,$SQLGroupClause,
|
$SQLWhereClause,$SQLGroupClause,
|
||||||
$SQLOrderClause));
|
$SQLOrderClause));
|
||||||
# execute query
|
# execute query
|
||||||
$DBVersQuery->execute(@SQLBindNames)
|
$DBVersQuery->execute(@SQLVersBindNames)
|
||||||
or &Bleat(2,sprintf("Can't get version data for %s from %s.%s: %s\n",
|
or &Bleat(2,sprintf("Can't get version data for %s from %s.%s: %s\n",
|
||||||
$CaptionPeriod,$Conf{'DBDatabase'},$Conf{'DBTable'},
|
$CaptionPeriod,$Conf{'DBDatabase'},$Conf{'DBTable'},
|
||||||
$DBI::errstr));
|
$DBI::errstr));
|
||||||
|
|
|
@ -12,6 +12,7 @@ NewsStats 0.4.0 (unreleased)
|
||||||
* DBClnts: set version length to 50.
|
* DBClnts: set version length to 50.
|
||||||
* gatherstats: Truncate overlong clients or versions.
|
* gatherstats: Truncate overlong clients or versions.
|
||||||
* gatherstats: Remove whitespace from client and version.
|
* gatherstats: Remove whitespace from client and version.
|
||||||
|
* Fix version queries.
|
||||||
|
|
||||||
NewsStats 0.3.0 (2025-05-18)
|
NewsStats 0.3.0 (2025-05-18)
|
||||||
* Extract GroupStats (in gatherstats) to subroutine.
|
* Extract GroupStats (in gatherstats) to subroutine.
|
||||||
|
|
Loading…
Reference in a new issue