} elsif ($commit_mode eq 'batch') {
announce('INFO', "Committing batch transaction");
eval { $db_handle->commit };
+ announce('ERR', "Unable to commit batch transaction : $@", 1) if $@;
}
}
}
} else {
+ if ($commit_mode eq 'each') {
+ eval { $db_handle->commit };
+ announce('ERR',
+ "Unable to commit patron purge transaction : $err")
+ if $err = $@;
+ }
- announce('DEBUG', "User $bc (ID $user_id) successfully purged");
- eval { $db_handle->commit } if $commit_mode eq 'each';
+ announce('DEBUG', "User $bc (ID $user_id) successfully purged")
+ unless $err;
}
}
if ($final and $rows > 0) {
# commit the current patron once all required rows are inserted.
- announce('DEBUG', "Inserted new patron $barcode");
- eval { $db_handle->commit } if $commit_mode eq 'each';
+
+ my $err;
+ if ($commit_mode eq 'each') {
+ eval { $db_handle->commit };
+ announce('WARNING',
+ "Unable to commit patron create transaction : $err")
+ if $err = $@;
+ }
+
+ announce('DEBUG', "Inserted new patron $barcode") unless $err;
$summary_stats{create}++;
}
return 1;
}
+# Patron updates not supported
sub update_patron {
my $phash = shift;
- announce('INFO', "Modifying patron with barcode " . $phash->{barcode});
+ # announce('INFO', "Modifying patron with barcode " . $phash->{barcode});
}
sub cleanup_db {