Separate $inout

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@192 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-16 13:56:34 +00:00
parent 9363b9211f
commit 420ac01e3f
3 changed files with 5 additions and 4 deletions

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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";