Bugzilla – Attachment 82092 Details for
Bug 21079
Unify metadata schema across backends
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21079: (follow-up) Move from Try::Tiny to eval
Bug-21079-follow-up-Move-from-TryTiny-to-eval.patch (text/plain), 2.31 KB, created by
Andrew Isherwood
on 2018-11-08 14:31:41 UTC
(
hide
)
Description:
Bug 21079: (follow-up) Move from Try::Tiny to eval
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2018-11-08 14:31:41 UTC
Size:
2.31 KB
patch
obsolete
>From b489de236ac97e569432b39e5787a0ce205f6238 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Thu, 8 Nov 2018 14:28:48 +0000 >Subject: [PATCH] Bug 21079: (follow-up) Move from Try::Tiny to eval > >In line with similar examples already in Koha, we now eval the >transaction, instead of putting it in a try/catch block. > >This patch also addressed the other comments made in >https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21079#c10 > >- AutoCommit & RaiseError are now reset >- Don't set the version if the update fails >--- > .../bug_21079_map_illrequestattributes.perl | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_21079_map_illrequestattributes.perl b/installer/data/mysql/atomicupdate/bug_21079_map_illrequestattributes.perl >index d7145cdc2f..79ed2d6de2 100644 >--- a/installer/data/mysql/atomicupdate/bug_21079_map_illrequestattributes.perl >+++ b/installer/data/mysql/atomicupdate/bug_21079_map_illrequestattributes.perl >@@ -1,4 +1,3 @@ >-use Try::Tiny; > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > >@@ -58,9 +57,10 @@ if( CheckVersion( $DBversion ) ) { > my $changed_str = join(',', @changed); > > if (scalar @changed > 0) { >+ my ($raise_error) = $dbh->{RaiseError}; > $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; >- try { >+ eval { > my $del = $dbh->do( > "DELETE FROM illrequestattributes ". > "WHERE illrequest_id IN ($changed_str)" >@@ -82,12 +82,18 @@ if( CheckVersion( $DBversion ) ) { > } > } > $dbh->commit; >- } catch { >- warn "Upgrade to $DBversion failed: $_"; >- eval { $dbh->rollback }; > }; >+ >+ if ($@) { >+ warn "Upgrade to $DBversion failed: $@\n"; >+ eval { $dbh->rollback }; >+ } else { >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 21079 - Unify metadata schema across backends)\n"; >+ } >+ >+ $dbh->{AutoCommit} = 1; >+ $dbh->{RaiseError} = $raise_error; > } > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 21079 - Unify metadata schema across backends)\n"; > } >-- >2.11.0
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 21079
:
77035
|
77036
|
79720
|
79725
|
80288
|
81740
| 82092