X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=mig-bin%2Fmig-loadbibs;h=119a1ec3445e56fe05f05153a814b14438027412;hp=c200fc6b33233ac3e1209c04876f445df2312891;hb=4ec23f88c7f20557b13ec6f5be637e726904e114;hpb=57eaa0c128e7db1c6a5412edb5dd4bc27e14b243 diff --git a/mig-bin/mig-loadbibs b/mig-bin/mig-loadbibs index c200fc6..119a1ec 100755 --- a/mig-bin/mig-loadbibs +++ b/mig-bin/mig-loadbibs @@ -126,7 +126,9 @@ if ($file_is_xml) { } $batch->strict_off(); -while ( my $record = $batch->next() ) { +my $record; +#while ( my $record = $batch->next() ) { +while ( eval {$record = $batch->next()} or do { if (!$record and !$@) { last; } else { next; }} ) { my $xml = $record->as_xml_record(); $xml = marc8_to_utf8($xml); $i++; @@ -135,9 +137,9 @@ while ( my $record = $batch->next() ) { my @warnings = $batch->warnings(); my $warning_string; if (@warnings) { $warning_string = "'" . join(':',@warnings) . "'"; } else { $warning_string = "'none'"; } - my $sql = "INSERT INTO $MIGSCHEMA.biblio_record_entry_legacy (marc,x_source,x_warnings) VALUES ($xml,'$source',$warning_string);"; + my $sql = "INSERT INTO $MIGSCHEMA.$stage_table (marc,x_source,x_warnings) VALUES ($xml,'$source',$warning_string);"; my $sth = $dbh->prepare($sql); - $sth->execute(); + eval { $sth->execute() }; report_progress("Records staged", $i) if 0 != $i % 100; }