bug 997682 Illegal mix of collations
This commit is contained in:
@@ -671,6 +671,34 @@ if ($is_minimum_common == FALSE) {
|
||||
|
||||
return ($i < $max) ? $i : -1;
|
||||
} // end of the 'PMA_isInto()' function
|
||||
|
||||
|
||||
/**
|
||||
* Returns a string formatted with proper charset introducer
|
||||
* and collate information, if MySQL supports it
|
||||
*
|
||||
* @param string the string itself
|
||||
* @param string the charset introducer we want
|
||||
* @param string the collation we want
|
||||
*
|
||||
* @return the formatted string
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function PMA_charsetIntroducerCollate($original_string, $charset_introducer, $collation)
|
||||
{
|
||||
$result = '';
|
||||
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
$result .= $charset_introducer;
|
||||
}
|
||||
$result .= '\'' . $original_string . '\'';
|
||||
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
$result .= ' COLLATE ' . $collation;
|
||||
}
|
||||
return $result;
|
||||
|
||||
} // end of the 'PMA_charsetIntroducerCollate()' function
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
7
main.php
7
main.php
@@ -167,6 +167,7 @@ include('./libraries/select_server.lib.php');
|
||||
* Displays the mysql server related links
|
||||
*/
|
||||
$is_superuser = FALSE;
|
||||
|
||||
if ($server > 0) {
|
||||
// Get user's global privileges ($dbh and $userlink are links to MySQL
|
||||
// defined in the "common.lib.php" library)
|
||||
@@ -181,7 +182,8 @@ if ($server > 0) {
|
||||
// (even if they cannot see the tables)
|
||||
$is_superuser = PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', $userlink, PMA_DBI_QUERY_STORE);
|
||||
if ($dbh) {
|
||||
$local_query = 'SELECT Create_priv, Reload_priv FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\'';
|
||||
// TODO: do we need to check the charset and collation of mysql.user?
|
||||
$local_query = 'SELECT Create_priv, Reload_priv FROM mysql.user WHERE User = ' . PMA_charsetIntroducerCollate(PMA_sqlAddslashes($mysql_cur_user),'_latin1', 'latin1_swedish_ci') . ';';
|
||||
$rs_usr = PMA_DBI_try_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE);
|
||||
if ($rs_usr) {
|
||||
while ($result_usr = PMA_DBI_fetch_assoc($rs_usr)) {
|
||||
@@ -200,7 +202,8 @@ if ($server > 0) {
|
||||
// the first inexistant db name that we find, in most cases it's probably
|
||||
// the one he just dropped :)
|
||||
if (!$is_create_priv) {
|
||||
$rs_usr = PMA_DBI_try_query('SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\';', $dbh, PMA_DBI_QUERY_STORE);
|
||||
$local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = ' . PMA_charsetIntroducerCollate('Y','_latin1','latin1_swedish_ci') . ' AND User = ' . PMA_charsetIntroducerCollate(PMA_sqlAddslashes($mysql_cur_user),'_latin1','latin1_swedish_ci') . ';';
|
||||
$rs_usr = PMA_DBI_try_query($local_query, $dbh, PMA_DBI_QUERY_STORE);
|
||||
if ($rs_usr) {
|
||||
$re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards
|
||||
$re1 = '(^|[^\])(\\\)+'; // escaped wildcards
|
||||
|
Reference in New Issue
Block a user