$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;
}
}
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();
"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;
}
);
$unsigned = array("", "unsigned", "zerofill", "unsigned zerofill");
$enum_length = '\'(?:\'\'|[^\'\\\\]+|\\\\.)*\'|"(?:""|[^"\\\\]+|\\\\.)*"';
+ $inout = array("IN", "OUT", "INOUT");
if (isset($_GET["table"])) {
include "./table.inc.php";