Separate process_length()

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@249 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2007-07-25 15:29:56 +00:00
parent 27067912d1
commit 7aaec14ab5
2 changed files with 6 additions and 1 deletions

View file

@ -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"]) . "'" : "")
;

View file

@ -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();