Champs date_day et date_time séparé au lieu du timestamp

tags/0.0.1
Daniel Berteaud 12 years ago
parent 5ba3e1444e
commit a58fefb902
  1. 3
      mail_log.sql
  2. 13
      root/usr/share/qpsmtpd/plugins/logging/log2sql

@ -1,6 +1,7 @@
CREATE TABLE `messages` ( CREATE TABLE `messages` (
`mail_id` varchar(255) NOT NULL default '', `mail_id` varchar(255) NOT NULL default '',
`time` int(11) default '0', `date_day` date,
`date_time` time,
`remote_ip` varchar(255) default NULL, `remote_ip` varchar(255) default NULL,
`remote_host` varchar(255) default NULL, `remote_host` varchar(255) default NULL,
`remote_info` varchar(255) default NULL, `remote_info` varchar(255) default NULL,

@ -4,10 +4,13 @@
# By Todor Todorov <tttodorov@yahoo.com> # # By Todor Todorov <tttodorov@yahoo.com> #
# http://www.geocities.com/tttodorov/ # # http://www.geocities.com/tttodorov/ #
# VERSION 0.06 # # VERSION 0.06 #
# Last modified 2005/02/22 # # Last modified 2012/10/11 #
# Edit by Daniel Berteaud #
# <daniel@firewall-services.com> #
##################################################### #####################################################
use DBI; use DBI;
use DateTime;
use strict; use strict;
#plugin level variables are here since version 0.02 #plugin level variables are here since version 0.02
@ -65,12 +68,16 @@ $transaction->notes('log2sql_mail_id', $mail_id);
# quote the mail_id for later use: # quote the mail_id for later use:
$mail_id = $dbh->quote($mail_id); $mail_id = $dbh->quote($mail_id);
my $dt = DateTime->now;
my($statement) = "INSERT INTO ".$mail_table." (mail_id,". my($statement) = "INSERT INTO ".$mail_table." (mail_id,".
$mail_table.".time,". $mail_table.".date_day,".
$mail_table.".date_time,".
"remote_ip,remote_host,remote_info) ". "remote_ip,remote_host,remote_info) ".
"VALUES(". "VALUES(".
$mail_id.",". $mail_id.",".
$dbh->quote(time).",". $dbh->quote($dt->ymd).",".
$dbh->quote($dt->hms).",".
$dbh->quote($self->qp->connection->remote_ip).",". $dbh->quote($self->qp->connection->remote_ip).",".
$dbh->quote($self->qp->connection->remote_host).",". $dbh->quote($self->qp->connection->remote_host).",".
$dbh->quote($self->qp->connection->remote_info).")"; $dbh->quote($self->qp->connection->remote_info).")";

Loading…
Cancel
Save