]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Support routines with comments in parameters (bug #460)
authorJakub Vrana <jakub@vrana.cz>
Wed, 24 Jan 2018 15:37:38 +0000 (16:37 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 24 Jan 2018 15:37:38 +0000 (16:37 +0100)
adminer/drivers/mysql.inc.php
changes.txt

index 872ea938a31998cae00e787e46d1934ecbae996c..354b08e7ce1557173a0c5b5d1962beea345d7551 100644 (file)
@@ -813,8 +813,9 @@ 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");
+               $space = "(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";
                $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";
+               $pattern = "$space*(" . ($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);
                $fields = array();
index a4c80da20817496d785581f211d7cca2b8cd5d32..2f2beb20ecfc81ea0d5505fa2f78a9234bcbc548 100644 (file)
@@ -6,6 +6,7 @@ Store current Adminer version server-side to avoid excessive requests
 Adminer: Fix Search data in tables (regression from 4.4.0)
 CSP: Allow any styles, images, media and fonts, disallow base-uri
 MySQL: Support geometry in MySQL 8 (bug #574)
+MySQL: Support routines with comments in parameters (bug #460)
 MariaDB: Support fulltext and spatial indexes in InnoDB (bug #583)
 SQLite: Enable foreign key checks
 PostgreSQL: Respect NULL default value