From 0025f2188a3ede138fc7f223689fcd225ff543c4 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 8 Mar 2015 13:06:45 -0700 Subject: [PATCH] MySQL: Fix usage of utf8mb4 if the client library doesn't support it --- adminer/drivers/mysql.inc.php | 11 +++++++++-- changes.txt | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index a16c02a8..661a18b0 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -27,6 +27,12 @@ if (!defined("DRIVER")) { return $return; } + function set_charset($charset) { + // the client library may not support utf8mb4 + parent::set_charset('utf8'); + return $this->query("SET NAMES $charset"); + } + function result($query, $field = 0) { $result = $this->query($query); if (!$result) { @@ -35,7 +41,7 @@ if (!defined("DRIVER")) { $row = $result->fetch_array(); return $row[$field]; } - + function quote($string) { return "'" . $this->escape_string($string) . "'"; } @@ -80,7 +86,8 @@ if (!defined("DRIVER")) { */ function set_charset($charset) { if (function_exists('mysql_set_charset')) { - return mysql_set_charset($charset, $this->_link); + // the client library may not support utf8mb4 + mysql_set_charset('utf8', $this->_link); } return $this->query("SET NAMES $charset"); } diff --git a/changes.txt b/changes.txt index 27f7a2f9..f5338264 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 4.2.1-dev: Send referrer header to the same domain +MySQL: Fix usage of utf8mb4 if the client library doesn't support it MySQL: Use utf8mb4 in export only if required SQLite: Use EXPLAIN QUERY PLAN in SQL query