- make use of mysql variable collation_database

- fixed call to PMA_DBI_fetch_value() (return second field, not first)
This commit is contained in:
Sebastian Mendel
2005-10-21 11:35:58 +00:00
parent be2abb7005
commit 330da1cf27
2 changed files with 6 additions and 15 deletions

View File

@@ -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 <lem9@users.sourceforge.net>
* server_databases.php: security fix

View File

@@ -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 '';
}