Bug 36822: (follow-up) Catch MySQL 8 failure in update

We add a CAST to the fetch of 0000-00-00 dates in the database. This
prevents an error in MySQL 8.0 throws htat aborts the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-11-14 13:08:16 +00:00 committed by Katrin Fischer
parent 1da78e8124
commit 36a387db22
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 1 additions and 3 deletions

View File

@ -12,17 +12,15 @@ return {
q{
SELECT borrowernumber
FROM borrowers
WHERE updated_on = '0000-00-00 00:00:00'
WHERE CAST(updated_on AS CHAR(19)) = '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 ) );
}
},
};