]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Fix usage of utf8mb4 if the client library doesn't support it
authorJakub Vrana <jakub@vrana.cz>
Sun, 8 Mar 2015 20:06:45 +0000 (13:06 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sun, 8 Mar 2015 20:07:20 +0000 (13:07 -0700)
adminer/drivers/mysql.inc.php
changes.txt

index a16c02a8a8cca0c3d3dd8c4803db66678018384a..661a18b0b14c75b627e9d2d10a7c703d8f24fd32 100644 (file)
@@ -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");
                        }
index 27f7a2f901fe3470c7bdb78cb3eff6afcbc3fef4..f5338264f4d85a53bab845a10fa10a7585d4f7f0 100644 (file)
@@ -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