SF.net SVN: postfixadmin: [157] trunk/VIRTUAL_VACATION/vacation.pl
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2007-10-16 21:43:58
|
Revision: 157 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=157&view=rev Author: christian_boltz Date: 2007-10-16 14:43:57 -0700 (Tue, 16 Oct 2007) Log Message: ----------- - fix a MySQL vs. PgSQL problem (True vs. 1) in vacation.pl https://sourceforge.net/forum/forum.php?thread_id=1845361&forum_id=676076 Modified Paths: -------------- trunk/VIRTUAL_VACATION/vacation.pl Modified: trunk/VIRTUAL_VACATION/vacation.pl =================================================================== --- trunk/VIRTUAL_VACATION/vacation.pl 2007-10-13 19:39:48 UTC (rev 156) +++ trunk/VIRTUAL_VACATION/vacation.pl 2007-10-16 21:43:57 UTC (rev 157) @@ -115,9 +115,13 @@ exit(0); } -# mysql only, needs FIX for ALL databases +my $db_true; # MySQL and PgSQL use different values for TRUE if ($db_type eq "mysql") { $dbh->do("SET CHARACTER SET utf8;"); + $db_true = '1'; +} else { # Pg + # TODO: SET CHARACTER SET is mysql only, needs FIX for ALL databases + $db_true = 'True'; } # used to detect infinite address lookup loops @@ -233,7 +237,7 @@ panic("possible infinite loop in find_real_address for <$email>. Check for alias loop\n"); } my $realemail; - my $query = qq{SELECT email FROM vacation WHERE email=? and active=true}; + my $query = qq{SELECT email FROM vacation WHERE email=? and active=$db_true}; my $stm = $dbh->prepare($query) or panic_prepare($query); $stm->execute($email) or panic_execute($query,"email='$email'"); my $rv = $stm->rows; @@ -251,7 +255,7 @@ if ($rv == 1) { my @row = $stm->fetchrow_array; my $alias = $row[0]; - $query = qq{SELECT email FROM vacation WHERE email=? and active=true}; + $query = qq{SELECT email FROM vacation WHERE email=? and active=$db_true}; $stm = $dbh->prepare($query) or panic_prepare($query); $stm->execute($alias) or panic_prepare($query,"email='$alias'"); $rv = $stm->rows; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |