SQL Redux
Martin Hepworth
maxsec at TOTALISE.CO.UK
Thu Jul 31 14:24:24 IST 2003
Steve
ok I got code to look like
# Sanitize reports
my($reports) = map { ($_ eq '')?'NULL':"$_" } join(' ', @report_array);
my($aplaces) = map { ($_ eq '')?'NULL':"$_" } join(',',
@{$message->{archiveplaces}});
my($myspamreport) = map { ($_ eq '')?'NULL':"$_" } $spamreport;
my($insmessage) = $message;
$insmessage->{to} = map { ($_ eq '')?'NULL':"$_" }
join(',',@{$message->{to}});
$insmessage->{subject} = map { ($_ eq '')?'NULL':"$_" }
$message->{subject};
$insmessage->{issaspam} = map { ($_ eq '')?'NULL':"$_" }
$message->{issaspam};
$insmessage->{isrblspam} = map { ($_ eq '')?'NULL':"$_" }
$message->{isrblspam};
# Insert the data
MailScanner::Log::WarnLog("trying to insert row: %s, %s, %s, %s, %s,
%s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s", $timestamp,
$insmessage->{
id}, $insmessage->{size}, $insmessage->{from}, $insmessage->{to},
$insmessage->{subject}, $insmessage->{clientip}, $aplaces,
$insmessage->{isspam}
, $insmessage->{ishigh}, $insmessage->{issaspam},
$insmessage->{isrblspam}, $ins
message->{spamwhitelisted}, $insmessage->{sascore}, $myspamreport,
$insmessage->
{virusinfected}, $insmessage->{nameinfected},
$insmessage->{otherinfected}, $rep
orts, $hostname);
$sth->execute(
$timestamp,
$dbh->quote($insmessage->{id}),
$insmessage->{size},
$dbh->quote($insmessage->{from}),
$dbh->quote($insmessage->{to}),
$dbh->quote($insmessage->{subject}),
$dbh->quote($insmessage->{clientip}),
$dbh->quote($aplaces),
$insmessage->{isspam},
$insmessage->{ishigh},
$insmessage->{issaspam},
$insmessage->{isrblspam},
$insmessage->{spamwhitelisted},
$insmessage->{sascore},
$dbh->quote($myspamreport),
$insmessage->{virusinfected},
$insmessage->{nameinfected},
$insmessage->{otherinfected},
$dbh->quote($reports),
$dbh->quote($hostname))
or MailScanner::Log::WarnLog("Cannot insert row: %s", $DBI::errstr);
and it's still not inserting in the DB..maillog says...
Jul 31 14:17:02 soloman MailScanner[61293]: trying to insert row:
2003-07-31 14:17:02, h6VDGvXL061292, 1060,
martinh at soloman.solid-state-logic.com, martinh at solid-state-logic.com,
test7, 127.0.0.1, NULL, 0, 0, 1, 1, 0, 0, NULL, 0, 0, 0, NULL,
soloman.solid-state-logic.com
Jul 31 14:17:02 soloman MailScanner[61293]: Cannot insert row: MySQL
server has gone away
Anybody any clues - my perl isn't great so..
--
martin
More information about the MailScanner
mailing list