Bugzilla – Attachment 174523 Details for
Bug 36822
When creating a new patron via LDAP or Shibboleth 0000-00-00 is inserted for invalid updated_on
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36822: (follow-up) Catch MySQL 8 failure in update
Bug-36822-follow-up-Catch-MySQL-8-failure-in-updat.patch (text/plain), 2.38 KB, created by
Martin Renvoize (ashimema)
on 2024-11-14 12:54:51 UTC
(
hide
)
Description:
Bug 36822: (follow-up) Catch MySQL 8 failure in update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-11-14 12:54:51 UTC
Size:
2.38 KB
patch
obsolete
>From 332d634b18ed9b25128dcc9b084262ea87460cca Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 14 Nov 2024 12:49:39 +0000 >Subject: [PATCH] Bug 36822: (follow-up) Catch MySQL 8 failure in update > >We add a try/catch around the call to fix 0000-00-00 dates in the >database. MySQL 8.0 throws an error on the WHERE clause for such a >search. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > installer/data/mysql/db_revs/240600056.pl | 35 ++++++++++++----------- > 1 file changed, 19 insertions(+), 16 deletions(-) > >diff --git a/installer/data/mysql/db_revs/240600056.pl b/installer/data/mysql/db_revs/240600056.pl >index 82b0413128a..b7e09718c8d 100755 >--- a/installer/data/mysql/db_revs/240600056.pl >+++ b/installer/data/mysql/db_revs/240600056.pl >@@ -1,5 +1,6 @@ > use Modern::Perl; > use Koha::Installer::Output qw(say_warning say_success say_info); >+use Try::Tiny qw( catch try ); > > return { > bug_number => "36822", >@@ -8,21 +9,23 @@ return { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > >- my $sth = $dbh->prepare( >- q{ >- SELECT borrowernumber >- FROM borrowers >- WHERE updated_on = '0000-00-00 00:00:00' >- } >- ); >- $sth->execute; >- my $results = $sth->fetchall_arrayref( {} ); >- >- if (@$results) { >- sanitize_zero_date( 'borrowers', 'updated_on' ); >- say_info( $out, "The following borrowers' updated_on has been sanitized: " >- . join( ', ', map { $_->{borrowernumber} } @$results ) ); >- } >- >+ try { >+ my $sth = $dbh->prepare( >+ q{ >+ SELECT borrowernumber >+ FROM borrowers >+ WHERE updated_on = '0000-00-00 00:00:00' >+ } >+ ); >+ $sth->execute; >+ my $results = $sth->fetchall_arrayref( {} ); >+ if (@$results) { >+ sanitize_zero_date( 'borrowers', 'updated_on' ); >+ say_info( $out, "The following borrowers' updated_on has been sanitized: " >+ . join( ', ', map { $_->{borrowernumber} } @$results ) ); >+ } >+ } catch { >+ say_warning( $out, "Unable to sanitize borrowers.updated_on, you may want to check for 0000-00-00 dates" ); >+ }; > }, > }; >-- >2.47.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 36822
:
173373
|
173374
|
173375
|
173376
|
173377
|
173385
|
173386
|
173387
|
173388
|
173389
|
173391
|
173392
|
173393
|
173394
|
173395
|
173402
|
173403
|
173404
|
173405
|
173406
|
173646
|
173903
|
173904
|
173905
|
173906
|
173907
|
173908
|
173909
|
174523
|
174525
|
174926
|
174927
|
174965