better compatibility for top index

This commit is contained in:
Marc Delisle
2004-10-30 00:25:41 +00:00
parent 3c0201527c
commit 7bad177f30
2 changed files with 18 additions and 5 deletions

View File

@@ -6,6 +6,11 @@ $Id$
$Source$
2004-10-29 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php (top index): MySQLi compatibility,
use PMA_convert_using() in case of non-latin1 user table,
and fix bug #1054467 (in case of BINARY User field)
2004-10-28 Alexander M. Turek <me@derrabus.de>
* user_password.php, lang/*.inc.php: Allow usage of old password hashing
function.

View File

@@ -915,12 +915,17 @@ if (empty($adduser) && empty($checkprivs)) {
if (PMA_MYSQL_INT_VERSION >= 40002) {
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv` FROM `user` ';
// the strtolower() is because sometimes the User field
// might be BINARY, so LIKE would be case sensitive
if (isset($initial)) {
$sql_query .= " WHERE `User` LIKE '" . $initial . "%'";
$sql_query .= " WHERE " . PMA_convert_using('User')
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
. " OR ". PMA_convert_using('User')
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
}
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$res = PMA_DBI_try_query($sql_query);
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
if (!$res) {
// the query failed! This may have two reasons:
@@ -933,11 +938,14 @@ if (empty($adduser) && empty($checkprivs)) {
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user`';
if (isset($initial)) {
$sql_query .= " WHERE `User` LIKE '" . $initial . "%'";
$sql_query .= " WHERE " . PMA_convert_using('User')
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
. " OR ". PMA_convert_using('User')
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
}
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$res = PMA_DBI_try_query($sql_query);
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
if (!$res) {
// the query failed! This may have two reasons:
@@ -972,7 +980,7 @@ if (empty($adduser) && empty($checkprivs)) {
$array_initials[chr($letter_counter + 64)] = FALSE;
}
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user` ORDER BY `User` ASC');
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(`User`,1)) FROM `user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE);
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
$array_initials[$tmp_initial] = TRUE;
}