PMA_getDbCollation():

- preserve selected db
 - make use of PMA_DBI_select_db()
 - documentation
This commit is contained in:
Sebastian Mendel
2005-10-27 06:29:43 +00:00
parent 8f9208e96b
commit 4a91d35542
2 changed files with 21 additions and 3 deletions

View File

@@ -8,6 +8,10 @@ $Source$
2005-10-27 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/common.lib.php::PMA_formatNumber(),
db_details_structure.php: do not truncate rowcount
* libraries/mysql_charsets.lib.php::PMA_getDbCollation():
- preserve selected db
- make use of PMA_DBI_select_db()
- documentation
2005-10-26 Marc Delisle <lem9@users.sourceforge.net>
* lang/french* updates

View File

@@ -275,8 +275,18 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
return $descr;
}
/**
* returns collation of given db
*
* @uses PMA_MYSQL_INT_VERSION
* @uses PMA_DBI_fetch_value()
* @uses PMA_DBI_select_db()
* @uses PMA_sqlAddSlashes()
* @uses $GLOBALS['db']
* @param string $db name of db
* @return string collation of $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
// information_schema database: We know it!
@@ -288,8 +298,12 @@ 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.
PMA_DBI_query('USE ' . PMA_backQuote( addslashes( $db ) ) );
return PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
PMA_DBI_select_db( $db );
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
if ( ! empty( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) {
PMA_DBI_select_db( $GLOBALS['db'] );
}
return $return;
}
return '';
}