]> git.joonet.de Git - adminer.git/commitdiff
Display routine parameter type in title (thanks to paranoiq)
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 28 Apr 2010 00:10:30 +0000 (00:10 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 28 Apr 2010 00:10:30 +0000 (00:10 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1507 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/call.inc.php
adminer/include/editing.inc.php

index 2c781968180aa6b54cd6520ed39e4d6783836467..2e449523d22b0915fd36026b43e1683e71ec8e96 100644 (file)
@@ -55,7 +55,7 @@ if ($in) {
        foreach ($in as $key) {
                $field = $routine["fields"][$key];
                $name = $field["field"];
-               echo "<tr><th>" . h($name);
+               echo "<tr><th>" . $adminer->fieldName($field);
                $value = $_POST["fields"][$name];
                if ($value != "" && ereg("enum|set", $field["type"])) {
                        $value = intval($value);
index 2c5c5334443a93fa3ff926fd8e0df5821ff66bba..c53b04c4fe40cc9ce3a9a3cce38a6201d5e265f8 100644 (file)
@@ -288,7 +288,7 @@ function normalize_enum($match) {
 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]+)['\"]?)?";
+       $type_pattern = "((" . implode("|", 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);
@@ -296,21 +296,25 @@ function routine($name, $type) {
        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[4]);
+               $data_type = strtolower($param[5]);
                $fields[] = array(
                        "field" => $name,
                        "type" => (isset($aliases[$data_type]) ? $aliases[$data_type] : $data_type),
-                       "length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $param[5]),
-                       "unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$param[7] $param[6]"))),
+                       "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],
                        "inout" => strtoupper($param[1]),
-                       "collation" => strtolower($param[8]),
+                       "collation" => strtolower($param[9]),
                );
        }
        if ($type != "FUNCTION") {
-               return array("fields" => $fields, "definition" => $match[10]);
+               return array("fields" => $fields, "definition" => $match[11]);
        }
-       $returns = array("type" => $match[10], "length" => $match[11], "unsigned" => $match[13], "collation" => $match[14]);
-       return array("fields" => $fields, "returns" => $returns, "definition" => $match[15]);
+       return array(
+               "fields" => $fields,
+               "returns" => array("type" => $match[12], "length" => $match[13], "unsigned" => $match[15], "collation" => $match[16]),
+               "definition" => $match[17],
+       );
 }
 
 /** Issue grant or revoke commands