diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 4a1e71e9..8e2df305 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -1159,7 +1159,7 @@ if (!defined('Adminer\DRIVER')) { /** Convert value in edit after applying functions back * @param array one element from fields() - * @param string + * @param string SQL expression * @return string */ function unconvert_field($field, $return) { diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 57875bdc..1df2040c 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -234,6 +234,11 @@ if (isset($_GET["pgsql"])) { } } + function enumLength($field) { + $enum = $this->types[lang('User types')][$field["type"]]; + return ($enum ? type_values($enum) : ""); + } + function setUserTypes($types) { $this->types[lang('User types')] = array_flip($types); } diff --git a/adminer/include/driver.inc.php b/adminer/include/driver.inc.php index 7e75edac..2bf48a25 100644 --- a/adminer/include/driver.inc.php +++ b/adminer/include/driver.inc.php @@ -59,6 +59,13 @@ abstract class SqlDriver { return array_map('array_keys', $this->types); } + /** Get enum values + * @param array + * @return string or null + */ + function enumLength($field) { + } + /** Select data from table * @param string * @param array result of $adminer->selectColumnsProcess()[0] diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index e1bd69a0..e8bedb07 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -924,14 +924,10 @@ function input($field, $value, $function) { $functions = (isset($_GET["select"]) || $reset ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field); $disabled = stripos($field["default"], "GENERATED ALWAYS AS ") === 0 ? " disabled=''" : ""; $attrs = " name='fields[$name]'$disabled"; - $types = $driver->types(); - $structured_types = $driver->structuredTypes(); - if (in_array($field["type"], (array) $structured_types[lang('User types')])) { - $enums = type_values($types[$field["type"]]); - if ($enums) { - $field["type"] = "enum"; - $field["length"] = $enums; - } + $enums = $driver->enumLength($field); + if ($enums) { + $field["type"] = "enum"; + $field["length"] = $enums; } if ($field["type"] == "enum") { echo h($functions[""]) . "