From e959e46fa50e08550d1ce0c6cd33e780d602dc17 Mon Sep 17 00:00:00 2001 From: Jared Brandt Date: Thu, 17 May 2018 05:56:35 -0600 Subject: [PATCH] Fixes foreign key pattern in MySQL Foreign keys are not displaying in MySQL when ANSI_QUOTES is enabled because the preg_match_all() is looking specifically for backticks. This fix allows for double quotes as well, so foreign keys are recognized even when ANSI_QUOTES is enabled. --- adminer/drivers/mysql.inc.php | 2 +- changes.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index c54ade0f..82ea8fc1 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -579,7 +579,7 @@ if (!defined("DRIVER")) { */ function foreign_keys($table) { global $connection, $on_actions; - static $pattern = '`(?:[^`]|``)+`'; + static $pattern = '(?:`(?:[^`]|``)+`)|(?:"(?:[^"]|"")+")'; $return = array(); $create_table = $connection->result("SHOW CREATE TABLE " . table($table), 1); if ($create_table) { diff --git a/changes.txt b/changes.txt index baa2a887..6b775e89 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,7 @@ Adminer 4.6.4-dev: Fix inline editing of empty cells (regression from 4.6.3) Allow adding more than two indexes and forign key columns at a time (regression from 4.4.0) Fix function change with set data type +MySQL: Support foreign keys created with ANSI quotes (bug #620) Adminer 4.6.3 (released 2018-06-28): Disallow using password-less databases