From 330da1cf275d15ec58e06f19997e9e23b22e10f2 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Fri, 21 Oct 2005 11:35:58 +0000 Subject: [PATCH] - make use of mysql variable collation_database - fixed call to PMA_DBI_fetch_value() (return second field, not first) --- ChangeLog | 3 +++ libraries/mysql_charsets.lib.php | 18 +++--------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 357243634..4b1d39203 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ $Source$ * db_details_export.php: - replaced for() with foreach() - dont pollute $GLOBALS['table'] + * libraries/mysql_charsets.lib.php: + - make use of mysql varaible collation_database + - fixed call to PMA_DBI_fetch_value() (return second field, not first) 2005-10-20 Marc Delisle * server_databases.php: security fix diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index c10bde20f..73c21fe34 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -275,7 +275,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ return $descr; } - function PMA_getDbCollation($db) { + function PMA_getDbCollation( $db ) { global $userlink; if (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') { // We don't have to check the collation of the virtual @@ -288,20 +288,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ } else if (PMA_MYSQL_INT_VERSION >= 40101) { // MySQL 4.1.0 does not support seperate charset settings // for databases. - $tokenized = explode(' ', PMA_DBI_fetch_value('SHOW CREATE DATABASE ' . PMA_backquote($db) . ';')); - - for ($i = 1; $i + 3 < count($tokenized); $i++) { - if ($tokenized[$i] == 'DEFAULT' && $tokenized[$i + 1] == 'CHARACTER' && $tokenized[$i + 2] == 'SET') { - // We've found the character set! - if (isset($tokenized[$i + 5]) && $tokenized[$i + 4] == 'COLLATE') { - return $tokenized[$i + 5]; // We found the collation! - } else { - // We did not find the collation, so let's return the - // default collation for the charset we've found. - return $GLOBALS['mysql_default_collations'][$tokenized [$i + 3]]; - } - } - } + PMA_DBI_query('USE ' . PMA_backQuote( addslashes( $db ) ) ); + return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 ); } return ''; }