From 7aaec14ab55cf83715c6bb23bd885d4a800e9edb Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Wed, 25 Jul 2007 15:29:56 +0000 Subject: [PATCH] Separate process_length() git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@249 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- editing.inc.php | 2 +- functions.inc.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/editing.inc.php b/editing.inc.php index 61413256..8aac7cb5 100644 --- a/editing.inc.php +++ b/editing.inc.php @@ -73,7 +73,7 @@ function edit_type($key, $field, $collations) { function process_type($field, $collate = "COLLATE") { global $mysql, $enum_length, $unsigned; return " $field[type]" - . ($field["length"] ? "(" . (preg_match("~^\\s*(?:$enum_length)(?:\\s*,\\s*(?:$enum_length))*\\s*\$~", $field["length"]) && preg_match_all("~$enum_length~", $field["length"], $matches) ? implode(",", $matches[0]) : preg_replace('~[^0-9,]~', '', $field["length"])) . ")" : "") + . ($field["length"] ? "(" . process_length($field["length"]) . ")" : "") . (preg_match('~int|float|double|decimal~', $field["type"]) && in_array($field["unsigned"], $unsigned) ? " $field[unsigned]" : "") . (preg_match('~char|text|enum|set~', $field["type"]) && $field["collation"] ? " $collate '" . $mysql->escape_string($field["collation"]) . "'" : "") ; diff --git a/functions.inc.php b/functions.inc.php index 4baa4848..264531d0 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -149,6 +149,11 @@ function where() { return $return; } +function process_length($length) { + global $enum_length; + return (preg_match("~^\\s*(?:$enum_length)(?:\\s*,\\s*(?:$enum_length))*\\s*\$~", $length) && preg_match_all("~$enum_length~", $length, $matches) ? implode(",", $matches[0]) : preg_replace('~[^0-9,]~', '', $length)); +} + function collations() { global $mysql; $return = array();