1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 09:39:51 +02:00

MariaDB: Fix missing uca1400 collations

Since MariaDB 10.10, one collation can be compatible with more character sets, so collations no longer have unique IDs.

Thanks to @shionryuu (https://github.com/adminerevo/adminerevo/issues/50)
This commit is contained in:
Peter Knut
2025-01-29 23:18:10 +01:00
parent 5c9e0f6d5a
commit 4a65703334

View File

@@ -642,8 +642,17 @@ if (isset($_GET["mysql"])) {
* @return array
*/
function collations() {
global $connection;
$return = array();
foreach (get_rows("SHOW COLLATION") as $row) {
// Since MariaDB 10.10, one collation can be compatible with more character sets, so collations no longer have unique IDs.
// All combinations can be selected from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY table.
$query = min_version('', '10.10', $connection) ?
"SELECT CHARACTER_SET_NAME AS Charset, FULL_COLLATION_NAME AS Collation, IS_DEFAULT AS `Default` FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY" :
"SHOW COLLATION";
foreach (get_rows($query) as $row) {
if ($row["Default"]) {
$return[$row["Charset"]][-1] = $row["Collation"];
} else {
@@ -651,9 +660,11 @@ if (isset($_GET["mysql"])) {
}
}
ksort($return);
foreach ($return as $key => $val) {
asort($return[$key]);
}
return $return;
}