|
Lines 351-358
sub export_marc_records_from_sth {
Link Here
|
| 351 |
# strung together with no single root element. zebraidx doesn't seem |
351 |
# strung together with no single root element. zebraidx doesn't seem |
| 352 |
# to care, though, at least if you're using the GRS-1 filter. It does |
352 |
# to care, though, at least if you're using the GRS-1 filter. It does |
| 353 |
# care if you're using the DOM filter, which requires valid XML file(s). |
353 |
# care if you're using the DOM filter, which requires valid XML file(s). |
| 354 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
354 |
eval { |
| 355 |
$num_exported++; |
355 |
print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); |
|
|
356 |
$num_exported++; |
| 357 |
}; |
| 358 |
if ($@) { |
| 359 |
warn "Error exporting record $record_number ($record_type) ".($noxml ? "not XML" : "XML"); |
| 360 |
} |
| 356 |
} |
361 |
} |
| 357 |
} |
362 |
} |
| 358 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
363 |
print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); |
|
Lines 449-463
sub get_raw_marc_record {
Link Here
|
| 449 |
$fetch_sth->execute($record_number); |
454 |
$fetch_sth->execute($record_number); |
| 450 |
if (my ($blob) = $fetch_sth->fetchrow_array) { |
455 |
if (my ($blob) = $fetch_sth->fetchrow_array) { |
| 451 |
$marc = MARC::Record->new_from_usmarc($blob); |
456 |
$marc = MARC::Record->new_from_usmarc($blob); |
| 452 |
$fetch_sth->finish(); |
457 |
unless ($marc) { |
| 453 |
} else { |
458 |
warn "error creating MARC::Record from $blob"; |
| 454 |
return; # failure to find a bib is not a problem - |
459 |
} |
| 455 |
# a delete could have been done before |
|
|
| 456 |
# trying to process a record update |
| 457 |
} |
460 |
} |
|
|
461 |
# failure to find a bib is not a problem - |
| 462 |
# a delete could have been done before |
| 463 |
# trying to process a record update |
| 464 |
|
| 465 |
$fetch_sth->finish(); |
| 466 |
return unless $marc; |
| 458 |
} else { |
467 |
} else { |
| 459 |
eval { $marc = GetMarcBiblio($record_number); }; |
468 |
eval { $marc = GetMarcBiblio($record_number); }; |
| 460 |
if ($@) { |
469 |
if ($@ || !$marc) { |
| 461 |
# here we do warn since catching an exception |
470 |
# here we do warn since catching an exception |
| 462 |
# means that the bib was found but failed |
471 |
# means that the bib was found but failed |
| 463 |
# to be parsed |
472 |
# to be parsed |
| 464 |
- |
|
|