commit ineffective with AutoCommit enabled... MailWatch.pm

ajos1 at onion ajos1 at onion.demon.co.uk
Thu May 29 17:27:25 IST 2008


Re: commit ineffective with AutoCommit enabled... MailWatch.pm

commit ineffective with AutoCommit enabled... MailWatch.pm
==========================================================


OKAY... MY FIRST SOLUTION IS WRONG!!!  This one works...
OKAY... MY FIRST SOLUTION IS WRONG!!!  This one works...
OKAY... MY FIRST SOLUTION IS WRONG!!!  This one works...
OKAY... MY FIRST SOLUTION IS WRONG!!!  This one works...


Basically... EVEN with AUTOCOMMIT ... there are times when "$dbh->commit" does work without warnings... so my original solution is not good news... as you could miss out on some crucial commits... if the disconnect statement does not do it for you...


/DBI-1.604/Driver.xst says: "Some databases will automatically commit on graceful disconnect."  (Ie) Not all do...


Here is the new solution... it leaves the commit as it was... but just turns off the warning temporarily! (Oh and it works)...

(ie) $dbh->{Warn} = 0;



Old Code - /usr/lib/MailScanner/MailScanner/CustomFunctions/MailWatch.pm
========================================================================
 sub ExitLogging {
   # Server exit - commit changes, close socket, and exit gracefully.
   close(SERVER);
   $dbh->commit;
   $dbh->disconnect;
   exit;
 }


New Code - /usr/lib/MailScanner/MailScanner/CustomFunctions/MailWatch.pm
========================================================================
 sub ExitLogging {
   # Server exit - commit changes, close socket, and exit gracefully.
   close(SERVER);
   ##### AJOS1 CHANGE #####
   $dbh->{Warn} = 0;
   ##### AJOS1 CHANGE #####
   $dbh->commit;
   $dbh->disconnect;
   exit;
 }

==
=====================================================================
=
= "What's it called when you put off procrastinating?"
=
=====================================================================
=  Need help with: Parking Tickets, Bailiffs, Capita or HertsGrid???
=  Call...    +44 8457 90 90 90    http://www.samaritans.org/
=====================================================================


More information about the MailScanner mailing list