set database default character set to utf8
This commit is contained in:
parent
636ed5ce9a
commit
cb0afaae73
1 changed files with 10 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue