Various charset / collation fixes.
This commit is contained in:
@@ -5,6 +5,14 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2003-12-29 Alexander M. Turek <crazysexycool@derrabus.de>
|
||||||
|
* db_details_structure.php, libraries/mysql_charsets.lib.php:
|
||||||
|
- display database collation (MySQL >= 4.1.1);
|
||||||
|
- list collations of all tables.
|
||||||
|
* tbl_properties_strcuture, tbl_properties_table_info.php:
|
||||||
|
- Changed "Charset" label to "Collation" because it fits better;
|
||||||
|
- The column collations weren't displayed with MySQL 5.0.
|
||||||
|
|
||||||
2003-12-28 Marc Delisle <lem9@users.sourceforge.net>
|
2003-12-28 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
### 2.5.5 released
|
### 2.5.5 released
|
||||||
|
|
||||||
|
@@ -3,14 +3,16 @@
|
|||||||
// vim: expandtab sw=4 ts=4 sts=4:
|
// vim: expandtab sw=4 ts=4 sts=4:
|
||||||
|
|
||||||
|
|
||||||
|
require_once('./libraries/grab_globals.lib.php');
|
||||||
|
require_once('./libraries/common.lib.php');
|
||||||
|
require_once('./libraries/mysql_charsets.lib.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares the tables list if the user where not redirected to this script
|
* Prepares the tables list if the user where not redirected to this script
|
||||||
* because there is no table in the database ($is_info is TRUE)
|
* because there is no table in the database ($is_info is TRUE)
|
||||||
*/
|
*/
|
||||||
if (empty($is_info)) {
|
if (empty($is_info)) {
|
||||||
require_once('./libraries/grab_globals.lib.php');
|
|
||||||
require_once('./libraries/common.lib.php');
|
|
||||||
|
|
||||||
// Drops/deletes/etc. multiple tables if required
|
// Drops/deletes/etc. multiple tables if required
|
||||||
if ((!empty($submit_mult) && isset($selected_tbl))
|
if ((!empty($submit_mult) && isset($selected_tbl))
|
||||||
|| isset($mult_btn)) {
|
|| isset($mult_btn)) {
|
||||||
@@ -37,41 +39,40 @@ if (empty($is_info)) {
|
|||||||
|
|
||||||
// Display function
|
// Display function
|
||||||
function pma_TableHeader($alternate = FALSE) {
|
function pma_TableHeader($alternate = FALSE) {
|
||||||
if ($alternate) {
|
echo ' <table border="' . $GLOBALS['cfg']['Border'] . '">' . "\n"
|
||||||
?>
|
. ' <tr>' . "\n"
|
||||||
<table border="<?php echo $GLOBALS['cfg']['Border']; ?>">
|
. ' <td></td>' . "\n"
|
||||||
<tr>
|
. ' <th>' . "\n"
|
||||||
<td></td>
|
. ' ' . $GLOBALS['strTable'] . ' ' . "\n"
|
||||||
<th> <?php echo $GLOBALS['strTable']; ?> </th>
|
. ' </th>' . "\n"
|
||||||
<th colspan="6"><?php echo $GLOBALS['strAction']; ?></th>
|
. ' <th colspan="6">' . "\n"
|
||||||
<th><?php echo $GLOBALS['strRecords']; ?></th>
|
. ' ' . $GLOBALS['strAction'] . ' ' . "\n"
|
||||||
</tr>
|
. ' </th>' . "\n"
|
||||||
<?php
|
. ' <th>' . "\n"
|
||||||
} else {
|
. ' ' . $GLOBALS['strRecords'] . ' ' . "\n"
|
||||||
?>
|
. ' </th>' . "\n";
|
||||||
<table border="<?php echo $GLOBALS['cfg']['Border']; ?>">
|
if (!$alternate) {
|
||||||
<tr>
|
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
|
||||||
<td></td>
|
echo ' <th>' . "\n"
|
||||||
<th> <?php echo $GLOBALS['strTable']; ?> </th>
|
. ' ' . $GLOBALS['strType'] . ' ' . "\n"
|
||||||
<th colspan="6"><?php echo $GLOBALS['strAction']; ?></th>
|
. ' </th>' . "\n";
|
||||||
<th><?php echo $GLOBALS['strRecords']; ?></th>
|
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||||
<?php
|
echo ' <th>' . "\n"
|
||||||
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
|
. ' ' . $GLOBALS['strCollation'] . ' ' . "\n"
|
||||||
?>
|
. ' </th>' . "\n";
|
||||||
<th><?php echo $GLOBALS['strType']; ?></th>
|
}
|
||||||
<?php
|
}
|
||||||
}
|
if ($GLOBALS['cfg']['ShowStats']) {
|
||||||
?>
|
echo ' <th>' . "\n"
|
||||||
<?php
|
. ' ' . $GLOBALS['strSize'] . ' ' . "\n"
|
||||||
if ($GLOBALS['cfg']['ShowStats']) {
|
. ' </th>' . "\n"
|
||||||
echo '<th>' . $GLOBALS['strSize'] . '</th>';
|
. ' <th>' . "\n"
|
||||||
echo '<th>' . $GLOBALS['strOverhead'] . '</th>';
|
. ' ' . $GLOBALS['strOverhead'] . ' ' . "\n"
|
||||||
}
|
. ' </th>' . "\n";
|
||||||
echo "\n";
|
}
|
||||||
?>
|
echo "\n";
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
echo ' </tr>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -378,11 +379,14 @@ else {
|
|||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if (!($cfg['PropertiesNumColumns'] > 1)) {
|
if (!($cfg['PropertiesNumColumns'] > 1)) {
|
||||||
?>
|
echo ' <td bgcolor="' . $bgcolor . '" nowrap="nowrap">' . "\n"
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
|
. ' ' . (isset($sts_data['Type']) ? $sts_data['Type'] : ' ') . ' ' . "\n"
|
||||||
<?php echo (isset($sts_data['Type']) ? $sts_data['Type'] : ' '); ?>
|
. ' </td>' . "\n";
|
||||||
</td>
|
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||||
<?php
|
echo ' <td bgcolor="' . $bgcolor . '" nowrap="nowrap">' . "\n"
|
||||||
|
. ' ' . (isset($sts_data['Collation']) ? '<dfn title="' . PMA_getCollationDescr($sts_data['Collation']) . '">' . $sts_data['Collation'] . '</dfn>' : '---') . ' ' . "\n"
|
||||||
|
. ' </td>' . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cfg['ShowStats']) {
|
if ($cfg['ShowStats']) {
|
||||||
@@ -439,11 +443,15 @@ else {
|
|||||||
</th>
|
</th>
|
||||||
<?php
|
<?php
|
||||||
if (!($cfg['PropertiesNumColumns'] > 1)) {
|
if (!($cfg['PropertiesNumColumns'] > 1)) {
|
||||||
?>
|
echo ' <th align="center">' . "\n"
|
||||||
<th align="center">
|
. ' <b>--</b>' . "\n"
|
||||||
<b>--</b>
|
. ' </th>' . "\n";
|
||||||
</th>
|
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||||
<?php
|
$db_collation = PMA_getDbCollation($db);
|
||||||
|
echo ' <th align="center">' . "\n"
|
||||||
|
. ' <b><dfn title="' . PMA_getCollationDescr($db_collation) . '">' . $db_collation . '</dfn></b> ' . "\n"
|
||||||
|
. ' </th>' . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cfg['ShowStats']) {
|
if ($cfg['ShowStats']) {
|
||||||
|
@@ -224,6 +224,36 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
|
|||||||
return $descr;
|
return $descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function PMA_getDbCollation($db) {
|
||||||
|
global $dbh;
|
||||||
|
|
||||||
|
if (PMA_MYSQL_INT_VERSION >= 40101) {
|
||||||
|
// MySQL 4.1.0 does not support seperate charset settings
|
||||||
|
// for databases.
|
||||||
|
|
||||||
|
$sql_query = 'SHOW CREATE DATABASE `' . $db . '`;';
|
||||||
|
$res = PMA_mysql_query($sql_query, $dbh) or PMA_mysqlDie(PMA_mysql_error($dbh), $sql_query);
|
||||||
|
$row = PMA_mysql_fetch_row($res);
|
||||||
|
mysql_free_result($res);
|
||||||
|
$tokenized = explode(' ', $row[1]);
|
||||||
|
unset($row, $res, $sql_query);
|
||||||
|
|
||||||
|
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]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -62,7 +62,7 @@ while ($row = PMA_mysql_fetch_array($result)) {
|
|||||||
mysql_free_result($result);
|
mysql_free_result($result);
|
||||||
|
|
||||||
// 3. Get fields
|
// 3. Get fields
|
||||||
$local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
|
$local_query = 'SHOW FULL FIELDS FROM ' . PMA_backquote($table);
|
||||||
$fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
|
$fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
|
||||||
$fields_cnt = mysql_num_rows($fields_rs);
|
$fields_cnt = mysql_num_rows($fields_rs);
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ $fields_cnt = mysql_num_rows($fields_rs);
|
|||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- TABLE INFORMATIONS -->
|
<!-- TABLE INFORMATION -->
|
||||||
|
|
||||||
<form method="post" action="tbl_properties_structure.php" name="fieldsForm">
|
<form method="post" action="tbl_properties_structure.php" name="fieldsForm">
|
||||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||||
@@ -83,7 +83,7 @@ $fields_cnt = mysql_num_rows($fields_rs);
|
|||||||
<td></td>
|
<td></td>
|
||||||
<th> <?php echo $strField; ?> </th>
|
<th> <?php echo $strField; ?> </th>
|
||||||
<th><?php echo $strType; ?></th>
|
<th><?php echo $strType; ?></th>
|
||||||
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <th>' . $strCharset . '</th>' . "\n" : ''; ?>
|
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <th>' . $strCollation . '</th>' . "\n" : ''; ?>
|
||||||
<th><?php echo $strAttr; ?></th>
|
<th><?php echo $strAttr; ?></th>
|
||||||
<th><?php echo $strNull; ?></th>
|
<th><?php echo $strNull; ?></th>
|
||||||
<th><?php echo $strDefault; ?></th>
|
<th><?php echo $strDefault; ?></th>
|
||||||
@@ -596,7 +596,7 @@ if ($cfg['ShowStats']) {
|
|||||||
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
|
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCharset; ?></td>
|
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCollation; ?></td>
|
||||||
<td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
|
<td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
|
||||||
<?php
|
<?php
|
||||||
echo '<dfn title="' . PMA_getCollationDescr($tbl_charset) . '">' . $tbl_charset . '</dfn>';
|
echo '<dfn title="' . PMA_getCollationDescr($tbl_charset) . '">' . $tbl_charset . '</dfn>';
|
||||||
|
@@ -19,7 +19,7 @@ $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, T
|
|||||||
$table_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
|
$table_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
|
||||||
$showtable = PMA_mysql_fetch_array($table_info_result);
|
$showtable = PMA_mysql_fetch_array($table_info_result);
|
||||||
$tbl_type = strtoupper($showtable['Type']);
|
$tbl_type = strtoupper($showtable['Type']);
|
||||||
$tbl_charset = empty($showtable['Charset']) ? '' : $showtable['Charset'];
|
$tbl_charset = empty($showtable['Collation']) ? '' : $showtable['Collation'];
|
||||||
$table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
$table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
||||||
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
||||||
$auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
|
$auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
|
||||||
|
Reference in New Issue
Block a user