You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/06/16 01:42:46 UTC

svn commit: r955092 - /spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm

Author: mmartinec
Date: Tue Jun 15 23:42:46 2010
New Revision: 955092

URL: http://svn.apache.org/viewvc?rev=955092&view=rev
Log:
Bug 6454: wrong status test on $sth->rows in BayesStore::PgSQL

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm?rev=955092&r1=955091&r2=955092&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm Tue Jun 15 23:42:46 2010
@@ -587,15 +587,17 @@ sub tok_touch {
   }
 
   my $rows = $sth->rows;
+  # returns the number of rows affected by the last row affecting command,
+  # or -1 if the number of rows is not known or not available
 
-  unless (defined($rows)) {
+  unless (defined($rows) && $rows >= 0) {
     dbg("bayes: tok_touch: SQL error: ".$self->{_dbh}->errstr());
     $self->{_dbh}->rollback();
     return 0;
   }
 
   # if we didn't update a row then no need to update newest_token_age
-  if ($rows eq '0E0') {
+  if (!$rows) {
     $self->{_dbh}->commit();
     return 1;
   }
@@ -748,15 +750,17 @@ sub tok_touch_all_old {
   }
 
   my $rows = $sth->rows;
+  # returns the number of rows affected by the last row affecting command,
+  # or -1 if the number of rows is not known or not available
 
-  unless (defined($rows)) {
+  unless (defined($rows) && $rows >= 0) {
     dbg("bayes: tok_touch_all: SQL error: ".$self->{_dbh}->errstr());
     $self->{_dbh}->rollback();
     return 0;
   }
 
   # if we didn't update a row then no need to update newest_token_age
-  if ($rows eq '0E0') {
+  if (!$rows) {
     $self->{_dbh}->commit();
     return 1;
   }