【发布时间】:2014-11-09 21:47:15
【问题描述】:
这是我的代码的一部分。我使用从 gmail 收到的消息 ID 进行选择。 msg_id以base64的形式存储在数据库中,不带符号“”。
my $inbox = $imap->select("Inbox") or die "Select error: ", $imap->LastError, "\n";
my @mails = ( $imap->unseen );
foreach my $msgid (@mails) {
my $m_id = $imap->parse_headers( $msgid, "Message-id" )->{"Message-id"}->[0] . "\n";
$m_id =~ s/[<\>]//g;
$m_id = encode_base64($m_id);
$m_id =~ s/\r?$//;
my $q1 = "select id from mails.mails_in where user_id=$param[5] and message_id=$m_id and user_remote_id=$param[6]";
$sth = $dbh->prepare($q1);
$rv = $sth->execute();
my @array;
while ( @array = $sth->fetchrow_array() ) {
foreach my $i (@array) {
print "$i\t";
}
print "\n";
}
}
但出现此错误。
DBD::Pg::st execute failed: ERROR: column "zdjkot..." does not exist
LINE 1: ...mails.mails_in where user_id=15206 and message_id=ZDJkOTQ1NT...
^ at ./script.pl line 65.
我尝试使用现有的 msg_id,从基础 - 结果是相似的。 另一个 SELECT 的工作正常。 类似的 SELECT 在 php 上正常工作。
我使用: Perl v5.18.2、PostgreSQL v8.4.14
【问题讨论】:
标签: perl postgresql dbi