]> git.joonet.de Git - adminer.git/commitdiff
MariaDB: Add support for UUID data type
authorvukbgit <info@vuk.bg.it>
Sat, 2 Nov 2024 13:52:23 +0000 (14:52 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Feb 2025 10:16:42 +0000 (11:16 +0100)
- MariaDB >= 10.7
- UUID string data type
- uuid() function for UUID type on new/edit item form

adminer/drivers/mysql.inc.php
adminer/include/functions.inc.php

index f86ff996a8f32fa3964a02a810d94ca0e53305ce..f2a4fed02a079f55d68e5da34b4cbe3a8473b8cd 100644 (file)
@@ -366,7 +366,7 @@ if (!defined("DRIVER")) {
        * @return mixed Min_DB or string for error
        */
        function connect() {
-               global $adminer, $types, $structured_types;
+               global $adminer, $types, $structured_types, $edit_functions;
                $connection = new Min_DB;
                $credentials = $adminer->credentials();
                if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
@@ -376,6 +376,11 @@ if (!defined("DRIVER")) {
                                $structured_types[lang('Strings')][] = "json";
                                $types["json"] = 4294967295;
                        }
+                       if (min_version('', 10.7, $connection)) {
+                               $structured_types[lang('Strings')][] = "uuid";
+                               $types["uuid"] = 128;
+                               $edit_functions[0]['uuid'] = 'uuid';
+                       }
                        return $connection;
                }
                $return = $connection->error;
index f637fdd4b17897ff05f76666cc2d7764bec5bf1b..05f2c6abbfb7cc6cc647b9fe3b1b4c05ae7819da 100644 (file)
@@ -107,7 +107,7 @@ function min_version($version, $maria_db = "", $connection2 = null) {
                $server_info = $match[1];
                $version = $maria_db;
        }
-       return (version_compare($server_info, $version) >= 0);
+       return $version && version_compare($server_info, $version) >= 0;
 }
 
 /** Get connection charset
@@ -1495,6 +1495,10 @@ function edit_form($table, $fields, $row, $update) {
                                $value = "";
                                $function = "now";
                        }
+                       if ($field["type"] == "uuid" && $value == "uuid()") {
+                               $value = "";
+                               $function = "uuid";
+                       }
                        input($field, $value, $function);
                        echo "\n";
                }