diff --git a/call.inc.php b/call.inc.php index 7a450b9f..b805e5bc 100644 --- a/call.inc.php +++ b/call.inc.php @@ -5,10 +5,10 @@ $routine = routine($_GET["call"], (isset($_GET["callf"]) ? "FUNCTION" : "PROCEDU $in = array(); $out = array(); foreach ($routine["fields"] as $i => $field) { - if (strcasecmp("out", substr($field["inout"], -3)) == 0) { + if (substr($field["inout"], -3) == "OUT") { $out[$i] = "@" . idf_escape($field["field"]) . " AS " . idf_escape($field["field"]); } - if (!$match[1] || strcasecmp("in", substr($field["inout"], 0, 2)) == 0) { + if (!$field["inout"] || substr($field["inout"], 0, 2) == "IN") { $in[] = $i; } } diff --git a/functions.inc.php b/functions.inc.php index 53615700..4f2b7b80 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -122,7 +122,7 @@ function normalize_enum($match) { function routine($name, $type) { global $mysql, $enum_length; - $pattern = "\\s*(IN|OUT|INOUT)?\\s*(?:`((?:[^`]+|``)*)`\\s*|\\b(\\S+)\\s+)([a-z]+)(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s+)?(unsigned(?:\\s+zerofill)?)?"; + $pattern = "\\s*(" . implode("|", $inout) . ")?\\s*(?:`((?:[^`]+|``)*)`\\s*|\\b(\\S+)\\s+)([a-z]+)(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s+)?(unsigned(?:\\s+zerofill)?)?"; $create = $mysql->result($mysql->query("SHOW CREATE $type " . idf_escape($name)), 2); preg_match("~\\($pattern(?:\\s*,$pattern)*~is", $create, $match); $params = array(); @@ -134,7 +134,7 @@ function routine($name, $type) { "length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $match[5]), "unsigned" => strtolower(preg_replace('~\\s+~', ' ', trim("$match[7] $match[6]"))), "null" => true, - "inout" => $match[1], + "inout" => strtoupper($match[1]), ); $params[$i] = $field; } diff --git a/index.php b/index.php index 752a3518..2e38fcc1 100644 --- a/index.php +++ b/index.php @@ -30,6 +30,7 @@ if (isset($_GET["dump"])) { ); $unsigned = array("", "unsigned", "zerofill", "unsigned zerofill"); $enum_length = '\'(?:\'\'|[^\'\\\\]+|\\\\.)*\'|"(?:""|[^"\\\\]+|\\\\.)*"'; + $inout = array("IN", "OUT", "INOUT"); if (isset($_GET["table"])) { include "./table.inc.php";