Bugzilla – Attachment 185855 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), 2.10 KB, created by
Nick Clemens (kidclamp)
on 2025-08-28 18:18:34 UTC
(
hide
)
Description:
Bug 38906: Use SUBSTRING and LOCATE over REGEXP_REPLACE
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-08-28 18:18:34 UTC
Size:
2.10 KB
patch
obsolete
>From 327f886582dcf9ced353552c7935f5fc6b1d9f90 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 >5 - repeat 2 >6 - Confirm column names are not affected on subsequent runs (items_group does not become group) >--- > installer/data/mysql/db_revs/240600064.pl | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/installer/data/mysql/db_revs/240600064.pl b/installer/data/mysql/db_revs/240600064.pl >index fce3f90d983..892fa0fc2b4 100755 >--- a/installer/data/mysql/db_revs/240600064.pl >+++ b/installer/data/mysql/db_revs/240600064.pl >@@ -11,8 +11,8 @@ return { > say $dbh->do( > q{ > UPDATE columns_settings >- SET columnname = REGEXP_REPLACE(columnname, '.*holdings_', '') >- WHERE module="catalogue" AND page="detail" AND ( tablename="holdings_table" OR tablename="otherholdings_table") >+ SET columnname = SUBSTRING(columnname,LOCATE("_",columnname)+1) >+ WHERE module="catalogue" AND page="detail" AND ( tablename="holdings_table" OR tablename="otherholdings_table") AND (columnname LIKE 'holdings_%' OR columnname LIKE 'otherholdings_%') > } > ); > 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
|
185855
|
186018