Bugzilla – Attachment 176659 Details for
Bug 38906
REGEXP_REPLACE not in MySQL < 5.7b DB update 24.06.00.064 fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38906: Use SUBSTRING and LOCATE over REGEXP_REPLACE
Bug-38906-Use-SUBSTRING-and-LOCATE-over-REGEXPREPL.patch (text/plain), 1.77 KB, created by
Nick Clemens (kidclamp)
on 2025-01-16 13:30:03 UTC
(
hide
)
Description:
Bug 38906: Use SUBSTRING and LOCATE over REGEXP_REPLACE
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-01-16 13:30:03 UTC
Size:
1.77 KB
patch
obsolete
>From 6ee4958bf153cc22f8e645505d39ab1516e18f70 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 16 Jan 2025 13:24:19 +0000 >Subject: [PATCH] Bug 38906: Use SUBSTRING and LOCATE over REGEXP_REPLACE > >To test: >1 - Check out an old version of Koha and set some columns settings for holdings tables, or: > UPDATE columns_settings > SET columnname = CONCAT("holdings_",columnname) > WHERE module = 'catalogue' AND page='detail' AND tablename = "holdings_table"; > UPDATE columns_settings > SET columnname = CONCAT("otherholdings_",columnname) > WHERE module = 'catalogue' AND page = 'detail' AND tablename = "otherholdings_table"; >2 - perl -e 'use C4::Installer; my $result = C4::Installer::run_db_rev("/kohadevbox/koha/installer/data/mysql/db_revs/240600064.pl"); warn Data::Dumper::Dumper($result)' >3 - SELECT columnname FROM columns_settings WHERE module="catalogue" AND page="detail" AND ( tablename="holdings_table" OR tablename="otherholdings_table"); >4 - Confirm column names are correct >--- > installer/data/mysql/db_revs/240600064.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/installer/data/mysql/db_revs/240600064.pl b/installer/data/mysql/db_revs/240600064.pl >index 7c460b3aaae..5cba6fbf8c9 100755 >--- a/installer/data/mysql/db_revs/240600064.pl >+++ b/installer/data/mysql/db_revs/240600064.pl >@@ -10,7 +10,7 @@ return { > > say $dbh->do(q{ > UPDATE columns_settings >- SET columnname = REGEXP_REPLACE(columnname, '.*holdings_', '') >+ SET columnname = SUBSTRING(columnname,LOCATE("_",columnname)+1) > WHERE module="catalogue" AND page="detail" AND ( tablename="holdings_table" OR tablename="otherholdings_table") > }); > say_success( $out, "Column names renamed" ); >-- >2.39.5
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 38906
: 176659