From 86e70394f2957c8b50c95fa908404689424fc169 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 26 Apr 2023 12:50:03 +0000 Subject: [PATCH] Bug 32250: (follow-up) Remove use of AutoCommit=0 This patch moves to using txn_begin and txn_commit --- misc/link_bibs_to_authorities.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index c80c469dd7..54f5716626 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -17,6 +17,7 @@ use Time::HiRes qw( time ); use POSIX qw( ceil strftime ); use Module::Load::Conditional qw( can_load ); +use Koha::Database; use Koha::SearchEngine; use Koha::SearchEngine::Indexer; @@ -81,7 +82,8 @@ my $dbh = C4::Context->dbh; my @updated_biblios = (); my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); -$dbh->{AutoCommit} = 0; +my $schema = Koha::Database->schema; +$schema->txn_begin; process_bibs( $linker, $bib_limit, $auth_limit, $commit, { tagtolink => $tagtolink, allowrelink => $allowrelink }); $dbh->commit(); @@ -111,9 +113,9 @@ sub process_bibs { } if ( not $test_only ) { - $dbh->commit; - $dbh->{AutoCommit} = 1; + $schema->txn_commit; $indexer->index_records( \@updated_biblios, "specialUpdate", "biblioserver" ); + $schema->txn_begin; } my $headings_linked = 0; @@ -248,11 +250,10 @@ sub process_bib { sub print_progress_and_commit { my $recs = shift; - $dbh->commit(); - $dbh->{AutoCommit} = 1; + $schema->txn_commit(); $indexer->index_records( \@updated_biblios, "specialUpdate", "biblioserver" ); - $dbh->{AutoCommit} = 0; @updated_biblios = (); + $schema->txn_begin(); print "... processed $recs records\n"; } -- 2.30.2