if (PMA_MYSQL_INT_VERSION >= 40100) {
/*
// If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version (if it exists)
if (!empty($GLOBALS['lang']) && (substr($GLOBALS['lang'], -5) != 'utf-8')) {
$lang_utf_8_version = substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-')) . '-utf-8';
if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {
$GLOBALS['lang'] = $lang_utf_8_version;
$GLOBALS['charset'] = $charset = 'utf-8';
}
}
// and we remove the non-UTF-8 choices to avoid confusion
if (!defined('PMA_REMOVED_NON_UTF_8')) {
$tmp_available_languages = $GLOBALS['available_languages'];
$GLOBALS['available_languages'] = array();
foreach ($tmp_available_languages AS $tmp_lang => $tmp_lang_data) {
if (substr($tmp_lang, -5) == 'utf-8') {
$GLOBALS['available_languages'][$tmp_lang] = $tmp_lang_data;
}
} // end foreach
unset($tmp_lang, $tmp_lang_data, $tmp_available_languages);
define('PMA_REMOVED_NON_UTF_8',1);
}
*/
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
if ($is_controluser || empty($collation_connection) || (strpos($collation_connection, '_') ? substr($collation_connection, 0, strpos($collation_connection, '_')) : $collation_connection) == $mysql_charset) {
PMA_DBI_query('SET NAMES ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
}
if (!empty($collation_connection)) {
PMA_DBI_query('SET collation_connection = \'' . $collation_connection . '\';', $link, PMA_DBI_QUERY_STORE);
}
if (!$is_controluser) {
$collation_connection = PMA_DBI_get_variable('collation_connection', PMA_DBI_GETVAR_SESSION, $link);
$charset_connection = PMA_DBI_get_variable('character_set_connection', PMA_DBI_GETVAR_SESSION, $link);
}
// Add some field types to the list
// (we pass twice here; feel free to code something better
if (!defined('PMA_ADDED_FIELD_TYPES')) {
$GLOBALS['cfg']['ColumnTypes'][] = 'BINARY';
$GLOBALS['cfg']['ColumnTypes'][] = 'VARBINARY';
define('PMA_ADDED_FIELD_TYPES',1);
}
} else {
require_once('./libraries/charset_conversion.lib.php');
}