Skip to content

Commit

Permalink
Fixes phpmyadmin#11447 MySQL 5.5 and the language system variable
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Delisle <[email protected]>
  • Loading branch information
Marc Delisle committed Aug 31, 2015
1 parent 6df17fd commit 9642af4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ phpMyAdmin - ChangeLog
- issue #11421 Stored-proc / routine - broken parameter parsing
- issue Missing name for configuration read_as_multibytes
- issue #11431 Incorrect "No row selected" message
- issue #11447 MySQL 5.5 and the language system variable

4.4.14.0 (2015-08-20)
- issue #11367 Export after search, missing WHERE clause
Expand Down
55 changes: 28 additions & 27 deletions libraries/DatabaseInterface.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,42 +228,43 @@ public function tryMultiQuery($multi_query = '', $link = null)
public function convertMessage($message)
{
// latin always last!
// @todo some values are missing,
// see https://mariadb.com/kb/en/mariadb/server-locale/

$encodings = array(
'japanese' => 'EUC-JP', //'ujis',
'japanese-sjis' => 'Shift-JIS', //'sjis',
'korean' => 'EUC-KR', //'euckr',
'russian' => 'KOI8-R', //'koi8r',
'ukrainian' => 'KOI8-U', //'koi8u',
'greek' => 'ISO-8859-7', //'greek',
'serbian' => 'CP1250', //'cp1250',
'estonian' => 'ISO-8859-13', //'latin7',
'slovak' => 'ISO-8859-2', //'latin2',
'czech' => 'ISO-8859-2', //'latin2',
'hungarian' => 'ISO-8859-2', //'latin2',
'polish' => 'ISO-8859-2', //'latin2',
'romanian' => 'ISO-8859-2', //'latin2',
'spanish' => 'CP1252', //'latin1',
'swedish' => 'CP1252', //'latin1',
'italian' => 'CP1252', //'latin1',
'norwegian-ny' => 'CP1252', //'latin1',
'norwegian' => 'CP1252', //'latin1',
'portuguese' => 'CP1252', //'latin1',
'danish' => 'CP1252', //'latin1',
'dutch' => 'CP1252', //'latin1',
'english' => 'CP1252', //'latin1',
'french' => 'CP1252', //'latin1',
'german' => 'CP1252', //'latin1',
'ja' => 'EUC-JP', //'ujis',
'ko' => 'EUC-KR', //'euckr',
'ru' => 'KOI8-R', //'koi8r',
'uk' => 'KOI8-U', //'koi8u',
'sr' => 'CP1250', //'cp1250',
'et' => 'ISO-8859-13', //'latin7',
'sk' => 'ISO-8859-2', //'latin2',
'cz' => 'ISO-8859-2', //'latin2',
'hu' => 'ISO-8859-2', //'latin2',
'pl' => 'ISO-8859-2', //'latin2',
'ro' => 'ISO-8859-2', //'latin2',
'es' => 'CP1252', //'latin1',
'sv' => 'CP1252', //'latin1',
'it' => 'CP1252', //'latin1',
'no' => 'CP1252', //'latin1',
'pt' => 'CP1252', //'latin1',
'da' => 'CP1252', //'latin1',
'nl' => 'CP1252', //'latin1',
'en' => 'CP1252', //'latin1',
'fr' => 'CP1252', //'latin1',
'de' => 'CP1252', //'latin1',
);

$server_language = $this->fetchValue(
'SHOW VARIABLES LIKE \'language\';',
'SELECT @@lc_messages;',
0,
1
0
);

if ($server_language) {
$found = array();
$match = preg_match(
'&(?:\\\|\\/)([^\\\\\/]*)(?:\\\|\\/)$&i',
'&([a-z][a-z])_&i',
$server_language,
$found
);
Expand Down
2 changes: 1 addition & 1 deletion libraries/dbi/DBIDummy.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
)
),
array(
'query' => 'SHOW VARIABLES LIKE \'language\';',
'query' => 'SELECT @@lc_messages;',
'result' => array(),
),
array(
Expand Down

0 comments on commit 9642af4

Please sign in to comment.