]> git.joonet.de Git - adminer.git/commitdiff
Fix enum types in routines (bug #391)
authorJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2014 21:30:07 +0000 (14:30 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2014 21:30:07 +0000 (14:30 -0700)
adminer/drivers/mysql.inc.php
adminer/index.php
changes.txt

index 7068ac0db3d2a4d920463c38e8d962a1f7c0070e..f332d693f7762f4f0763d525bf56bbcffce32f33 100644 (file)
@@ -796,7 +796,7 @@ if (!defined("DRIVER")) {
        function routine($name, $type) {
                global $connection, $enum_length, $inout, $types;
                $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar");
-               $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]*|$enum_length)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
+               $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")\\b(?:\\s*\\(((?:[^'\")]|$enum_length)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";
                $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern";
                $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2);
                preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match);
index 523baf3c88ef798ccfd1a83652e8c0ad929e0a91..f6eeeb21876309c97391c138e8cc7372071cb8f2 100644 (file)
@@ -10,7 +10,7 @@
 include "./include/bootstrap.inc.php";
 include "./include/tmpfile.inc.php";
 
-$enum_length = "'(?:''|[^'\\\\]|\\\\.)*+'";
+$enum_length = "'(?:''|[^'\\\\]|\\\\.)*'";
 $inout = "IN|OUT|INOUT";
 
 if (isset($_GET["select"]) && ($_POST["edit"] || $_POST["clone"]) && !$_POST["save"]) {
index 26aedb88eea0287ca6ca6bdc9b686b0cc10764a7..537e07884b2d6ae322f1d57e8af8310df1a2c53e 100644 (file)
@@ -5,6 +5,7 @@ Display edit form after error in clone or multi-edit
 Display time of the select command
 Print elapsed time in HTML instead of SQL command comment
 Improve gzip export ratio (bug #387)
+Fix enum types in routines (bug #391)
 MySQL: Fix editing rows by binary values, bug since Adminer 3.7.1
 MySQL: Respect daylight saving time in dump, bug since Adminer 3.6.4
 MySQL 5.6.5+: Support ON UPDATE on datatime column