On Sun, 11 Mar 2001, Mike<mickalo>Blezien wrote:
..
> This maybe more of a MySQL question than DBI, but I have a Perl script
> that does 4 INSERTS into various tables. I know MySQL doesn't support
> Transactions, but when the data is inserted into the tables and during
> the process a error is encountered during an insert, is there an way
> to undo what was entered into any other tables prior to the error. I
> normally use "$dbh->do($query); on all UPDATES and INSERTS.

I think there isn't a clean way. The "clean" way is to do:

eval {
 # do lots of stuff here
};

if ($@) {
 $dbh->rollback;
} else {
 $dbh->commit;
}

BTW the latest MySQL *does* support transactions on the BDB table type.


-- 

---------------------------------------------------------------------
Orlando Andico <[EMAIL PROTECTED]>       POTS Phone: +63   (2) 848-2893
Mosaic Communications, Inc.            GSM Mobile: +63 (917) 531-5893
I'm not suffering from insanity -- I'm enjoying  every minute of it!!

Reply via email to