https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6454
Summary: wrong status test on $sth->rows in BayesStore::PgSQL
Product: Spamassassin
Version: 3.3.1
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Libraries
AssignedTo: [email protected]
ReportedBy: [email protected]
The return value from $sth->rows is inappropriately tested
for string equality to '0E0', instead of testing its numeric
value, as required by the DBI module documentation.
A change like the following:
my $rows = $sth->rows;
- if ($rows eq '0E0') {
+ if (!$rows) {
is needed in two places in BayesStore::PgSQL.
(the MySQL counterpart seems fine).
The mistake probably originates from the fact that a call to
$dbh->do() does return '0E0' for no rows affected, while a
call to $sth->rows is different and returns a numeric value,
and a -1 on error. This was probably a cut/paste mistake
when making BayesStore::PgSQL out of BayesStore::MySQL,
or an unwarranted assumption without reading the DBI docs
and proper testing.
The mistake causes unnecessary updating of bayes_vars
with each call to tok_touch_all, instead of doing it only
when the number of rows affected is greater than zero.
Functionality is unaffected, just some redundant work is
performed.
--
Configure bugmail:
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.