From 32f2000034e61f485b919b42ba1dc15b62de8a7f Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 25 Feb 2011 10:49:19 +0100 Subject: [PATCH] Respect default collation (bug #3191489) --- adminer/drivers/mysql.inc.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index c8f6e994..dbd17c99 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -307,7 +307,7 @@ if (!defined("DRIVER")) { $return = $match[1]; } elseif (preg_match('~ CHARACTER SET ([^ ]+)~', $create, $match)) { // default collation - $return = $collations[$match[1]][0]; + $return = $collations[$match[1]][-1]; } return $return; } @@ -479,11 +479,15 @@ if (!defined("DRIVER")) { function collations() { $return = array(); 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); foreach ($return as $key => $val) { - sort($return[$key]); + asort($return[$key]); } return $return; }