List Info

Thread: Patch for PostgreSQL and send-quarantine-digests.pl




Patch for PostgreSQL and send-quarantine-digests.pl
user name
2006-07-27 00:08:01
Not sure about how / where that $isPg should be placed, but
the date_add 
fix is definitely required ...

***
/usr/local/src/maia-1.0.1/scripts/send-quarantine-digests.pl
       Thu Apr  6 06:11:49 2006
--- /var/amavis/maia/scripts/send-quarantine-digests.pl Thu
Jul 27 00:06:00 2006
***************
*** 156,161 ****
--- 156,162 ----
   my ($secs, $mins, $hours, $day, $mon, $year) =
localtime($timestamp);
   my $dbtimestamp = sprintf("%04d-%02d-%02d
%02d:%02d:%02d", $year+1900, $mon+1, $day, $hours,
$mins, $secs);

+ my $isPg = $dsn =~ /^DBI:Pg/;
   my $unixTime = $isPg ? "(
ROUND(DATE_PART('epoch', NOW())) -
ROUND(DATE_PART('epoch',
maia_users.last_digest_sent)))"
                        : "(UNIX_TIMESTAMP() -
UNIX_TIMESTAMP(maia_users.last_digest_sent))";

***************
*** 202,208 ****
   my $update_sth = $dbh->prepare($query)
       or fatal(sprintf("Couldn't prepare query:
%s", $dbh->errstr));

! my $date_add = $isPg ? "NOW() + INTERVAL ?
DAY"
            : "DATE_ADD(NOW(), INTERVAL ? DAY)";
   $query = <<"endSQL;";
     INSERT INTO maia_tokens (token_system, token, data,
expires)
--- 203,210 ----
   my $update_sth = $dbh->prepare($query)
       or fatal(sprintf("Couldn't prepare query:
%s", $dbh->errstr));

! my $isPg = $dsn =~ /^DBI:Pg/;
! my $date_add = $isPg ? "NOW() + ( ? || '
DAY')::INTERVAL"
            : "DATE_ADD(NOW(), INTERVAL ? DAY)";
   $query = <<"endSQL;";
     INSERT INTO maia_tokens (token_system, token, data,
expires)



----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email . scrappyhub.org                              MSN .
scrappyhub.org
Yahoo . yscrappy               Skype: hub.org        ICQ .
7615664
_______________________________________________
Maia-users mailing list
Maia-usersrenaissoft.com
http://www.renaissoft.com/mailman/listinfo/maia-users
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )