Safety by example
$dbh = DBI->connect(…, …, …, {
AutoCommit => 0, RaiseError => 1
$sth = $dbh->prepare('insert into table values (?)');
foreach (@array_of_long_strings) {
$@ ? $dbh->rollback : $dbh->commit;
Notes:
must be an ‘atomic’ operation.
Can’t allow debit without the credit.
Server-side errors: disk crash etc
Client side errors: program die()’s or is killed