]> git.joonet.de Git - adminer.git/commitdiff
Respect default collation (bug #3191489)
authorJakub Vrana <jakub@vrana.cz>
Fri, 25 Feb 2011 09:49:19 +0000 (10:49 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 25 Feb 2011 09:49:19 +0000 (10:49 +0100)
adminer/drivers/mysql.inc.php

index c8f6e994a2644c822beadd611771b16fb7caec6f..dbd17c99e76ef23873c27a32a76bfacda1e491f3 100644 (file)
@@ -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;
        }