You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2008/05/26 11:02:37 UTC
svn commit: r660135 -
/spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm
Author: jm
Date: Mon May 26 02:02:36 2008
New Revision: 660135
URL: http://svn.apache.org/viewvc?rev=660135&view=rev
Log:
bug 5730: when using Postgres >= 8.1.0 with Bayes, this error occurs: 'WARNING: nonstandard use of \ in a string literal at character'. fix, thanks to Tomasz Ostrowski
Modified:
spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm
Modified: spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm?rev=660135&r1=660134&r2=660135&view=diff
==============================================================================
--- spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm (original)
+++ spamassassin/branches/3.2/lib/Mail/SpamAssassin/BayesStore/PgSQL.pm Mon May 26 02:02:36 2008
@@ -729,7 +729,7 @@
my $tokenarray = join(",", map { '"' . _quote_bytea($_) . '"' } sort @{$tokens});
- my $sth = $self->{_dbh}->prepare("select touch_tokens($self->{_userid}, '{$tokenarray}', $atime)");
+ my $sth = $self->{_dbh}->prepare("select touch_tokens($self->{_userid}, $self->{_esc_prefix}'{$tokenarray}', $atime)");
unless (defined($sth)) {
dbg("bayes: tok_touch_all: SQL error: ".$self->{_dbh}->errstr());
@@ -890,6 +890,12 @@
dbg("bayes: database connection established");
}
+ if ( $dbh->{pg_server_version} >= 80100 ) {
+ $self->{_esc_prefix} = 'E';
+ } else {
+ $self->{_esc_prefix} = '';
+ }
+
$self->{_dbh} = $dbh;
return 1;
@@ -933,7 +939,7 @@
}
my $escaped_token = _quote_bytea($token);
- my $sth = $self->{_dbh}->prepare("select put_tokens($self->{_userid},'{$escaped_token}',
+ my $sth = $self->{_dbh}->prepare("select put_tokens($self->{_userid},$self->{_esc_prefix}'{$escaped_token}',
$spam_count,$ham_count,$atime)");
unless (defined($sth)) {
@@ -997,7 +1003,7 @@
my $tokenarray = join(",", map { '"' . _quote_bytea($_) . '"' } sort keys %{$tokens});
- my $sth = $self->{_dbh}->prepare("select put_tokens($self->{_userid}, '{$tokenarray}',
+ my $sth = $self->{_dbh}->prepare("select put_tokens($self->{_userid}, $self->{_esc_prefix}'{$tokenarray}',
$spam_count, $ham_count, $atime)");
unless (defined($sth)) {