diff --git a/ChangeLog b/ChangeLog index 94144d215..c8f3bab00 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2006-02-22 Marc Delisle * libraries/display_tbl.lib.php: bug #1435303, error on empty BLOB transf. + * libraries/database_interface.lib.php PMA_DBI_get_tables_full(): + added workaround for bug #1436171 Cannot display Capitalised Databases 2006-02-22 Michal Čihař * libraries/iconv_wrapper.lib.php, libraries/charset_conversion.lib.php: diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 0fee1294d..48622b107 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -370,8 +370,20 @@ function PMA_DBI_get_tables_full($database, $table = false, } } - if ( ! is_array($database) && isset($tables[$database]) ) { - return $tables[$database]; + if (! is_array($database)) { + if (isset($tables[$database])) { + return $tables[$database]; + } elseif (isset($tables[strtolower($database)])) { + // on windows with lower_case_table_names = 1 + // MySQL returns + // with SHOW DATABASES or information_schema.SCHEMATA: `Test` + // but information_schema.TABLES gives `test` + // bug #1436171 + // sf.net/tracker/?func=detail&aid=1436171&group_id=23067&atid=377408 + return $tables[strtolower($database)]; + } else { + return $tables; + } } else { return $tables; } @@ -603,9 +615,11 @@ function PMA_DBI_get_columns_full($database = null, $table = null, /** * @TODO should only return columns names, for more info use PMA_DBI_get_columns_full() * + * @deprecated by PMA_DBI_get_columns() or PMA_DBI_get_columns_full() * @param string $database name of database * @param string $table name of table to retrieve columns from * @param mixed $link mysql link resource + * @return array column info */ function PMA_DBI_get_fields($database, $table, $link = null) { @@ -621,6 +635,27 @@ function PMA_DBI_get_fields($database, $table, $link = null) return $fields; } +/** + * array PMA_DBI_get_columns(string $database, string $table, bool $full = false, mysql db link $link = null) + * + * @param string $database name of database + * @param string $table name of table to retrieve columns from + * @param boolean $full wether to return full info or only column names + * @param mixed $link mysql link resource + * @return array column names + */ +function PMA_DBI_get_columns($database, $table, $full = false, $link = null) +{ + $fields = PMA_DBI_fetch_result( + 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS + FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table), + 'Fields', ($full ? null : 'Fields'), $link); + if ( ! is_array($fields) || count($fields) < 1 ) { + return false; + } + return $fields; +} + /** * returns value of given mysql server variable *