Lines 580-597
sub BatchCommitRecords {
Link Here
|
580 |
my $logged_in_patron = Koha::Patrons->find( $userenv->{number} ); |
580 |
my $logged_in_patron = Koha::Patrons->find( $userenv->{number} ); |
581 |
|
581 |
|
582 |
my $rec_num = 0; |
582 |
my $rec_num = 0; |
|
|
583 |
my @biblio_ids; |
584 |
$schema->txn_begin; # We commit in a transaction |
583 |
while (my $rowref = $sth->fetchrow_hashref) { |
585 |
while (my $rowref = $sth->fetchrow_hashref) { |
584 |
$record_type = $rowref->{'record_type'}; |
586 |
$record_type = $rowref->{'record_type'}; |
585 |
|
587 |
|
586 |
# first record, begin transaction |
|
|
587 |
$schema->txn_begin |
588 |
unless $rec_num; |
589 |
|
590 |
$rec_num++; |
588 |
$rec_num++; |
591 |
|
589 |
|
592 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
590 |
if ($progress_interval and (0 == ($rec_num % $progress_interval))) { |
593 |
# report progress and commit |
591 |
# report progress and commit |
594 |
&$progress_callback($rec_num, $schema); |
592 |
$schema->txn_commit; |
|
|
593 |
&$progress_callback( $rec_num ); |
595 |
$schema->txn_begin; |
594 |
$schema->txn_begin; |
596 |
} |
595 |
} |
597 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
596 |
if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { |
Lines 708-714
sub BatchCommitRecords {
Link Here
|
708 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
707 |
SetImportRecordStatus($rowref->{'import_record_id'}, 'ignored'); |
709 |
} |
708 |
} |
710 |
} |
709 |
} |
711 |
&$progress_callback($rec_num, $schema); # Make sure to commit the final chunk that didn't hit the commit threshhold |
710 |
$schema->txn_commit; # Commit final records that may not have hit callback threshhold |
712 |
$sth->finish(); |
711 |
$sth->finish(); |
713 |
SetImportBatchStatus($batch_id, 'imported'); |
712 |
SetImportBatchStatus($batch_id, 'imported'); |
714 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |
713 |
return ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored); |