]> git.joonet.de Git - adminer.git/commitdiff
Change regular expression (bug #2859386)
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 16 Sep 2009 21:47:23 +0000 (21:47 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 16 Sep 2009 21:47:23 +0000 (21:47 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1111 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/editing.inc.php

index 907847f4412f27dfd7136dbe2a9e4a392323f0b8..56f08e4426399d7b7800bbf04e9738e9f2ba9cfa 100644 (file)
@@ -231,9 +231,9 @@ function normalize_enum($match) {
 }
 
 function routine($name, $type) {
-       global $dbh, $enum_length, $inout;
+       global $dbh, $enum_length, $inout, $types;
        $aliases = array("bit" => "tinyint", "bool" => "tinyint", "boolean" => "tinyint", "integer" => "int", "double precision" => "float", "real" => "float", "dec" => "decimal", "numeric" => "decimal", "fixed" => "decimal", "national char" => "char", "national varchar" => "varchar");
-       $type_pattern = "([a-z]+)(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
+       $type_pattern = "(" . implode("|", array_keys($types + $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
        $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
        $create = $dbh->result($dbh->query("SHOW CREATE $type " . idf_escape($name)), 2);
        preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match);