Permalink
Browse files

Change regular expression (bug #2859386)

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1111 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 24801a0 commit 79c70ad5fb0a44419338e8b4baea775cfc30ba23 jakubvrana committed Sep 16, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 adminer/include/editing.inc.php
@@ -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);

0 comments on commit 79c70ad

Please sign in to comment.