Skip to content

Commit

Permalink
set database default character set to utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Knop committed Oct 7, 2009
1 parent 636ed5c commit cb0afaa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/upgrades/upgrade_7.8.1-7.8.2.pl
Expand Up @@ -63,7 +63,16 @@ sub fixTableDefaultCharsets {
['utf8'],
);
}
# and here's our code
my $db_name = $db->dbh->{Name};
my $database = (split /[;:]/, $db_name)[0];
while ( $db_name =~ /([^=;:]+)=([^;:]+)/msxg ) {
if ( $1 eq 'db' || $1 eq 'database' || $1 eq 'dbname' ) {
$database = $2;
last;
}
}
$session->db->write(sprintf 'ALTER DATABASE %s DEFAULT CHARACTER SET utf8', $db->dbh->quote_identifier($database));

print "Done.\n" unless $quiet;
}

Expand Down

0 comments on commit cb0afaa

Please sign in to comment.