From: Matt Tyson Date: Tue, 28 Jul 2015 16:46:56 +0000 (+0200) Subject: Bug 1186700: Inserting data into the mail_staging table fails on PostgreSQL due to... X-Git-Tag: release-5.0.1~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdc4581ff1a2b73ef5c4c9d07825cfa599e5b972;p=thirdparty%2Fbugzilla.git Bug 1186700: Inserting data into the mail_staging table fails on PostgreSQL due to unspecified BLOB type r=gerv a=sgreen --- diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 0b82ded41c..6c4de83e78 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -41,6 +41,8 @@ sub MessageToMTA { return; } + my $dbh = Bugzilla->dbh; + my $email; if (ref $msg) { $email = $msg; @@ -58,11 +60,14 @@ sub MessageToMTA { # email immediately, in case the transaction is rolled back. Instead we # insert it into the mail_staging table, and bz_commit_transaction calls # send_staged_mail() after the transaction is committed. - if (! $send_now && Bugzilla->dbh->bz_in_transaction()) { + if (! $send_now && $dbh->bz_in_transaction()) { # The e-mail string may contain tainted values. my $string = $email->as_string; trick_taint($string); - Bugzilla->dbh->do("INSERT INTO mail_staging (message) VALUES(?)", undef, $string); + + my $sth = $dbh->prepare("INSERT INTO mail_staging (message) VALUES (?)"); + $sth->bind_param(1, $string, $dbh->BLOB_TYPE); + $sth->execute; return; }