Respect default collation (bug #3191489)

This commit is contained in:
Jakub Vrana 2011-02-25 10:49:19 +01:00
parent f842e33bee
commit 32f2000034

View file

@ -307,7 +307,7 @@ if (!defined("DRIVER")) {
$return = $match[1]; $return = $match[1];
} elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) { } elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) {
// default collation // default collation
$return = $collations[$match[1]][0]; $return = $collations[$match[1]][-1];
} }
return $return; return $return;
} }
@ -479,11 +479,15 @@ if (!defined("DRIVER")) {
function collations() { function collations() {
$return = array(); $return = array();
foreach (get_rows("SHOW COLLATION") as $row) { foreach (get_rows("SHOW COLLATION") as $row) {
$return[$row["Charset"]][] = $row["Collation"]; if ($row["Default"]) {
$return[$row["Charset"]][-1] = $row["Collation"];
} else {
$return[$row["Charset"]][] = $row["Collation"];
}
} }
ksort($return); ksort($return);
foreach ($return as $key => $val) { foreach ($return as $key => $val) {
sort($return[$key]); asort($return[$key]);
} }
return $return; return $return;
} }