Re: dbi transactions error handling

2010-09-21 Thread Paolo Lunazzi
; > my $rv; > SWITCH: { >   last unless($rv = $sql_live->execute(@record)); >   last unless($rv = $sql_dwh->execute(@record)); > > }; > > if($rv){ >   $dbh->commit();} > > else{ >   warn "Transaction failed, rolling back. Error was:\n $dbh->e

Re: dbi transactions error handling

2010-09-21 Thread Paolo Lunazzi
Thanks for your solution. Your code works well but I don't understand why in my example eval doesn't catch the error and why, even in your example, with PrintError = 0 I get on output all the warnings of statements failed. Transactions section in DBI documentation recommends to use RaiseError and e

dbi transactions error handling

2010-09-20 Thread Paolo Lunazzi
Hi all, I'm working on a script that should manage transactions. My code is something like this: --- CODE --- $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; $dbh->{AutoCommit} = 0; eval { $sql_live->execute( $row_id, $file_id, $offset, $country, $date_day,