fixed #10279: Some columns still latin1 after upgrade to 7.5.40

This commit is contained in:
Graham Knop 2009-08-11 22:30:23 +00:00
parent 686d79d76d
commit b54a3a0262
2 changed files with 42 additions and 0 deletions

View file

@ -3,6 +3,7 @@
- fixed: #9595: Gallery layout corruption with old browsers
- fixed #10753: Admin Bar will only display 1 title at a time
- fixed #10751: Only users in Content Managers group can make Shortcuts
- fixed #10279: Some columns still latin1 after upgrade to 7.5.40
- fixed #10748: In-store credit not reported correctly in email
- fixed #10746: SQL queriy is improper for MySQL compliant query
- fixed: Existing ThingyRecords are broken after upgrade

View file

@ -36,6 +36,7 @@ fixGalleyImageFolderStyle($session);
fixMapTemplateFolderStyle($session);
fixDefaultSQLReportDownloadGroup($session);
addExpireIncompleteSurveyResponsesWorkflow($session);
ensureAllFieldsUtf8($session);
finish($session); # this line required
@ -49,6 +50,46 @@ finish($session); # this line required
# print "DONE!\n" unless $quiet;
#}
sub ensureAllFieldsUtf8 {
my $session = shift;
print "\tEnsuring all database fields are UTF-8... " unless $quiet;
my $dbh = $session->db->dbh;
my $sth;
my @tables;
my @stmts;
# Get table list
$sth = $dbh->table_info(undef, undef, '%');
while (my $row = $sth->fetchrow_hashref) {
push @tables, $row->{TABLE_NAME};
}
$sth->finish;
for my $table (@tables) {
my $sth = $dbh->column_info(undef, undef, $table, '%');
while (my $row = $sth->fetchrow_hashref) {
if ($row->{TYPE_NAME} =~ /(?:VAR)?CHAR|TEXT/i) {
push @stmts, sprintf('ALTER TABLE %s MODIFY %s %s %s CHARACTER SET utf8 %s %s',
$dbh->quote_identifier($row->{TABLE_NAME}),
$dbh->quote_identifier($row->{COLUMN_NAME}),
$row->{mysql_type_name},
($row->{COLUMN_SIZE} == 22 ? 'binary' : ''),
($row->{IS_NULLABLE} eq 'NO' ? 'NOT NULL' : ''),
(defined $row->{COLUMN_DEF} && $row->{COLUMN_DEF} ne '' ? 'DEFAULT ' . $dbh->quote($row->{COLUMN_DEF}) : ''),
);
}
}
$sth->finish;
}
for my $stmt (@stmts) {
$dbh->do($stmt);
}
print "Done.\n" unless $quiet;
}
sub addFriendManagerSettings {
my $session = shift;
print "\tAdding Friend Manager Style and Layout template settings... " unless $quiet;