From 021a11f1114b8a3a6bd2c88c7506d86f955e9735 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Thu, 9 Mar 2023 11:35:42 -0500 Subject: [PATCH] Bug 33183: Error inserting matchpoint_components when creating record matching rules with MariaDB 10.6 The word "offset" is now a keyword. At the very least we need to escape the fieldname with backticks. It would be nice to switch to Koha::Objects for this module eventually. C4::Matcher::_store_matchpoint(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset, length) VALUES ('27', '1', '999'...' at line 2 at /usr/share/koha/lib/C4/Matcher.pm line 314 Test Plan: 1) Set up Koha with MariaDB 10.6 2) Attempt to create a matching rule 3) Note the error screen 4) Apply this patch 5) Restart all the things! 6) Attempt to create another matching rule 7) No errors this time Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 4628d2e81cf97951e978ae1e18a6939767ad2b09) Signed-off-by: Matt Blenkinsop (cherry picked from commit ece005da13e632778c9e5546a5061323e05a4cf0) Signed-off-by: Lucas Gass --- C4/Matcher.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 77716f736c..7322c14417 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -342,7 +342,7 @@ sub _store_matchpoint { foreach my $component (@{ $matchpoint->{'components'} }) { $seqnum++; $sth = $dbh->prepare_cached("INSERT INTO matchpoint_components - (matchpoint_id, sequence, tag, subfields, offset, length) + (matchpoint_id, sequence, tag, subfields, `offset`, length) VALUES (?, ?, ?, ?, ?, ?)"); $sth->bind_param(1, $matchpoint_id); $sth->bind_param(2, $seqnum); -- 2.39.5