Browse files

Separate process_length()

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@249 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 2706791 commit 7aaec14ab55cf83715c6bb23bd885d4a800e9edb jakubvrana committed Jul 25, 2007
Showing with 6 additions and 1 deletion.
  1. +1 −1 editing.inc.php
  2. +5 −0 functions.inc.php
View
2 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"]) . "'" : "")
;
View
5 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();

0 comments on commit 7aaec14

Please sign in to comment.