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

This commit is contained in:
Daniel Berteaud 2012-10-11 11:33:36 +02:00
parent 5ba3e1444e
commit a58fefb902
2 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,7 @@
CREATE TABLE `messages` (
`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_host` varchar(255) default NULL,
`remote_info` varchar(255) default NULL,

View File

@ -4,10 +4,13 @@
# By Todor Todorov <tttodorov@yahoo.com> #
# http://www.geocities.com/tttodorov/ #
# VERSION 0.06 #
# Last modified 2005/02/22 #
# Last modified 2012/10/11 #
# Edit by Daniel Berteaud #
# <daniel@firewall-services.com> #
#####################################################
use DBI;
use DateTime;
use strict;
#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:
$mail_id = $dbh->quote($mail_id);
my $dt = DateTime->now;
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) ".
"VALUES(".
$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_host).",".
$dbh->quote($self->qp->connection->remote_info).")";