diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 994c1a0f..aca228d6 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -705,8 +705,8 @@ if (!defined("DRIVER")) { */ function routine($name, $type) { global $connection, $enum_length, $inout, $types; - $aliases = array("bit" => "tinyint", "bool" => "tinyint", "boolean" => "tinyint", "integer" => "int", "double precision" => "float", "real" => "float", "dec" => "decimal", "numeric" => "decimal", "fixed" => "decimal", "national char" => "char", "national varchar" => "varchar"); - $type_pattern = "((" . implode("|", array_keys($types + $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; + $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar"); + $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2); preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match); @@ -714,10 +714,9 @@ if (!defined("DRIVER")) { preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER); foreach ($matches as $param) { $name = str_replace("``", "`", $param[2]) . $param[3]; - $data_type = strtolower($param[5]); $fields[] = array( "field" => $name, - "type" => (isset($aliases[$data_type]) ? $aliases[$data_type] : $data_type), + "type" => strtolower($param[5]), "length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $param[6]), "unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$param[8] $param[7]"))), "full_type" => $param[4], diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 0e4ccd8b..1ebdb422 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -108,9 +108,9 @@ function referencable_primary($self) { * @return null */ function edit_type($key, $field, $collations, $foreign_keys = array()) { - global $structured_types, $unsigned, $inout, $on_actions; + global $structured_types, $types, $unsigned, $inout, $on_actions; ?> - + " size="3" onfocus="editingLengthFocus(this);">