Bugzilla – Attachment 35384 Details for
Bug 13577
The correct COLLATE is not set to all DB tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG 7134 [QA Followup]: Prevent utf8mb4 collation change
BUG-7134-QA-Followup-Prevent-utf8mb4-collation-cha.patch (text/plain), 1.81 KB, created by
Martin Renvoize (ashimema)
on 2015-01-19 13:51:49 UTC
(
hide
)
Description:
BUG 7134 [QA Followup]: Prevent utf8mb4 collation change
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2015-01-19 13:51:49 UTC
Size:
1.81 KB
patch
obsolete
>From e0fd8e0bda978a1e87d5164880f7e1b78f01a475 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 19 Jan 2015 13:48:42 +0000 >Subject: [PATCH] BUG 7134 [QA Followup]: Prevent utf8mb4 collation change > >utf8mb4 is a superset of utf8 adn thus is compatible. We should not >force an entire db change upon people who have proactively set utf8 >encoding before now. > >This patch aslo removed the deprecaed ->tables stanze in favour of the >table_info stanze. > >http://bugs.koha-community.org/show_bug.cgi?id=13577 >--- > installer/data/mysql/updatedatabase.pl | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 4653c02..2b70d32 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9658,10 +9658,16 @@ if(CheckVersion($DBversion)) { > > $DBversion = "3.19.00.006"; > if ( CheckVersion($DBversion) ) { >- $dbh->do(q|SET foreign_key_checks = 0|);; >- my @tables = $dbh->tables(); >- for my $table ( @tables ) { >- $dbh->do(qq|ALTER TABLE $table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|); >+ $dbh->do(q|SET foreign_key_checks = 0|); >+ my $sth = $dbh->table_info( '','','','TABLE' ); >+ my ( $cat, $schema, $name, $type, $remarks ); >+ while ( ( $cat, $schema, $name, $type, $remarks ) = $sth->fetchrow_array ) { >+ my $table_sth = $dbh->prepare(qq|SHOW CREATE TABLE $name|); >+ $table_sth->execute; >+ my @table = $table_sth->fetchrow_array; >+ unless ( $table[1] =~ /CHARSET=utf8/ ) { #catches utf8 and utf8mb4 tables >+ $dbh->do(qq|ALTER TABLE $table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|); >+ } > } > $dbh->do(q|SET foreign_key_checks = 1|);; > >-- >1.7.10.4
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 13577
:
35176
|
35182
|
35333
|
35384