Bugzilla – Attachment 122611 Details for
Bug 28399
batchRebuildItemsTables.pl error 'Already in a transaction'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28399: Remove txn error from batchRebuildItemsTables.pl
Bug-28399-Remove-txn-error-from-batchRebuildItemsT.patch (text/plain), 2.47 KB, created by
Marcel de Rooy
on 2021-07-06 11:09:08 UTC
(
hide
)
Description:
Bug 28399: Remove txn error from batchRebuildItemsTables.pl
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-07-06 11:09:08 UTC
Size:
2.47 KB
patch
obsolete
>From 024aaf99a679ceb9702b5210ddcce2605e3f06e0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 24 Jun 2021 15:11:18 +0200 >Subject: [PATCH] Bug 28399: Remove txn error from batchRebuildItemsTables.pl >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > misc/batchRebuildItemsTables.pl | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > >diff --git a/misc/batchRebuildItemsTables.pl b/misc/batchRebuildItemsTables.pl >index 5bb40e5d35..58630cbded 100755 >--- a/misc/batchRebuildItemsTables.pl >+++ b/misc/batchRebuildItemsTables.pl >@@ -46,9 +46,9 @@ GetOptions( > pod2usage(1) if $help || ( !$confirm && !$test_parameter ); > print "### Database will not be modified ###\n" if $test_parameter; > >-#dbh > my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >+my $schema = Koha::Database->schema; >+$schema->txn_begin; > > #sysprefs > C4::Context->disable_syspref_cache() if ( defined( C4::Context->disable_syspref_cache() ) ); >@@ -56,7 +56,10 @@ my $CataloguingLog = C4::Context->preference('CataloguingLog'); > my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); > $dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'"); > $dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'"); >-$dbh->commit() unless $test_parameter; >+unless ($test_parameter){ >+ $schema->txn_commit; >+ $schema->txn_begin; >+} > my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber" ); > > #dbh query init >@@ -93,8 +96,10 @@ while ( my ( $biblionumber, $biblioitemnumber, $frameworkcode ) = $sth->fetchrow > if ($@) { warn "Problem with : $biblionumber : $@"; warn $record->as_formatted; } > } > } >- unless ($test_parameter) { >- $dbh->commit() unless $count % 1000; >+ >+ unless ($test_parameter || $count % 1000) { >+ $schema->txn_commit; >+ $schema->txn_begin; > } > } > >@@ -102,7 +107,7 @@ my $sthCataloguingLog = $dbh->prepare("UPDATE systempreferences SET value=? WHER > $sthCataloguingLog->execute($CataloguingLog); > my $sthmergelimit = $dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='AuthorityMergeLimit'"); > $sthmergelimit->execute($mergelimit); >-$dbh->commit() unless $test_parameter; >+$schema->txn_commit unless $test_parameter; > my $timeneeded = time() - $starttime; > print "$count MARC record done in $timeneeded seconds\n"; > if ( scalar(@errors) > 0 ) { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28399
:
122385
| 122611