Experimental MySQL 4.1 support (RFE #623665) and some small fixes.

This commit is contained in:
Alexander M. Turek
2003-05-30 14:17:13 +00:00
parent d5b8e45e2c
commit 36a1167150
4 changed files with 81 additions and 38 deletions

View File

@@ -8,6 +8,20 @@ $Source$
2003-05-30 Alexander M. Turek <rabus@users.sourceforge.net> 2003-05-30 Alexander M. Turek <rabus@users.sourceforge.net>
* lang/bulgarian-*.inc.php3: Updates, thanks to * lang/bulgarian-*.inc.php3: Updates, thanks to
Stanislav Yordanov (stanprog). Stanislav Yordanov (stanprog).
* tbl_properties_structure.inc.php3:
- Fixed display for tables with few indexes;
- BLOBs are always binary;
- RFE #623665 (MySQL 4.1 support):
- Fixed display of field charsets;
- The table charset is now displayed.
* libraries/sqlparser.data.php3: Added CHARSET.
* tbl_change.php3: binary fields with CHARACTER SET definition were treated
as SET fields (again RFE #623665).
* Documentation.html:
- Declared MySQL 4.1 support as experimental;
- Added some notes about MySQL 4.1 / 5.0;
- php 5.0.0-dev should work fine with phpMyAdmin - it has been doing so at
least on my test machines for a couple of months.
2003-05-29 Michal Cihar <nijel@users.sourceforge.net> 2003-05-29 Michal Cihar <nijel@users.sourceforge.net>
* lang/czech: Updated. * lang/czech: Updated.

View File

@@ -62,8 +62,8 @@
<ul> <ul>
<li> <li>
PHP3 or PHP4: phpMyAdmin widely uses the 'str_replace()' PHP function PHP3, PHP4 or PHP5: phpMyAdmin widely uses the 'str_replace()' PHP
that was added in PHP&nbsp;3.0.6, but was buggy up until function that was added in PHP&nbsp;3.0.6, but was buggy up until
PHP&nbsp;3.0.8. PHP&nbsp;3.0.8.
Then <span class="important">you should not run this script with Then <span class="important">you should not run this script with
PHP3&nbsp;&lt;&nbsp;3.0.8</span>.<br /> PHP3&nbsp;&lt;&nbsp;3.0.8</span>.<br />
@@ -73,10 +73,10 @@
GD2 support in PHP. GD2 support in PHP.
</li> </li>
<li> <li>
MySQL (tested with 3.21.x, 3.22.x, 3.23.x and 4.0.x);<br /> MySQL (tested with 3.21.x, 3.22.x, 3.23.x, 4.0.x and 4.1.x);<br />
<span class="important">Note: Because of a major change in the definition <span class="important">
syntax of string field types, this version of phpMyAdmin probably won't Note: The implemented MySQL&nbsp;4.1.x support is experimental!
work correctly with MySQL&nbsp;&gt;=&nbsp;4.1.0!</span> </span>
</li> </li>
<li> <li>
a web-browser (doh!). a web-browser (doh!).
@@ -427,8 +427,8 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
The port-number of your $i-th MySQL-server. Default is 3306 (leave The port-number of your $i-th MySQL-server. Default is 3306 (leave
blank). If you use &quot;localhost&quot; as the hostname, MySQL blank). If you use &quot;localhost&quot; as the hostname, MySQL
ignores this port number and connects with the socket, so if you want ignores this port number and connects with the socket, so if you want
to connect to a port different from the default port, use to connect to a port different from the default port, use
&quot;127.0.0.1&quot; or the real hostname in &quot;127.0.0.1&quot; or the real hostname in
$cfg['Servers'][$i]['host']. $cfg['Servers'][$i]['host'].
<br /><br /> <br /><br />
</dd> </dd>
@@ -1075,7 +1075,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
up tables by the above Separator. up tables by the above Separator.
<br /><br /> <br /><br />
</dd> </dd>
<dt><b>$cfg['ShowTooltip'] </b>boolean</dt> <dt><b>$cfg['ShowTooltip'] </b>boolean</dt>
<dd> <dd>
Defines whether to display table comment as tool-tip in left frame or Defines whether to display table comment as tool-tip in left frame or
@@ -1336,7 +1336,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<dt><b>$cfg['IconvExtraParams'] </b>string</dt> <dt><b>$cfg['IconvExtraParams'] </b>string</dt>
<dd> <dd>
Specify some parameters for iconv used in charset conversion. See Specify some parameters for iconv used in charset conversion. See
<a <a
href="http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html">iconv href="http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html">iconv
documentation</a> for details. documentation</a> for details.
@@ -1619,10 +1619,10 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<dt><b>$cfg['MaxExactCount'] </b>integer</dt> <dt><b>$cfg['MaxExactCount'] </b>integer</dt>
<dd> <dd>
Determines for how large tables phpMyAdmin should get exact row count by Determines for how large tables phpMyAdmin should get exact row count by
<code>SELECT COUNT</code>. If approximate row count is smaller than this <code>SELECT COUNT</code>. If approximate row count is smaller than this
value, <code>SELECT COUNT</code> will be used, otherwise only value value, <code>SELECT COUNT</code> will be used, otherwise only value
returned by <code>SHOW TABLE STATUS</code>. returned by <code>SHOW TABLE STATUS</code>.
<br /><br /> <br /><br />
</dd> </dd>
@@ -2176,13 +2176,16 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
</p> </p>
<h4> <h4>
[1.17] Does phpMyAdmin support MySQL&nbsp;4.1? [1.17] Does phpMyAdmin support MySQL&nbsp;4.1 and 5.0?
</h4> </h4>
<p> <p>
Because of a major change in the definition syntax of string field types, phpMyAdmin provides limited support for MySQL&nbsp;4.1. That means that you
this version of phpMyAdmin probably won't work correctly with can neither assign character sets to a table or field on create nor change
MySQL&nbsp;&gt;=&nbsp;4.1.0! We will work on the support as soon as the (automatically) assigned character set.<br />
MySQL&nbsp;4.1.0 is released. When compiling php, we strongly recommend that you manually link it to a
MySQL&nbsp;4.1 client library since the one that is currently bundled with
php is rather old and might cause problems.<br />
MySQL 5 is not yet supported.
</p> </p>
<h4> <h4>
@@ -3014,12 +3017,12 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
<a name="underscore"></a><br /> <a name="underscore"></a><br />
<h4> <h4>
[6.10] When creating a privilege, what happens with underscores in [6.10] When creating a privilege, what happens with underscores in
the database name? the database name?
</h4> </h4>
<p> <p>
If you do not put a backslash before the underscore, this is a wildcard If you do not put a backslash before the underscore, this is a wildcard
grant, and the underscore means &quot;any character&quot;. So, if the grant, and the underscore means &quot;any character&quot;. So, if the
database name is &quot;john_db&quot;, the user would get rights to john1db, database name is &quot;john_db&quot;, the user would get rights to john1db,
john2db...<br /><br /> john2db...<br /><br />
If you put a backslash before the underscore, it means that the database If you put a backslash before the underscore, it means that the database

View File

@@ -84,7 +84,7 @@ if (isset($primary_key)) {
$local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key; $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$row = PMA_mysql_fetch_array($result); $row = PMA_mysql_fetch_array($result);
// No row returned // No row returned
if (!$row) { if (!$row) {
unset($row); unset($row);
@@ -212,7 +212,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
} else { } else {
$rowfield = $field; $rowfield = $field;
} }
// loic1: current date should not be set as default if the field is NULL // loic1: current date should not be set as default if the field is NULL
// for the current row // for the current row
// lem9: but do not put here the current datetime if there is a default // lem9: but do not put here the current datetime if there is a default
@@ -336,7 +336,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
<?php <?php
echo "\n"; echo "\n";
$selected = ''; $selected = '';
// garvin: Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR' // garvin: Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
// or something similar. Then directly look up the entry in the RestrictFunctions array, // or something similar. Then directly look up the entry in the RestrictFunctions array,
// which will then reveal the available dropdown options // which will then reveal the available dropdown options
@@ -345,7 +345,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
} else { } else {
$dropdown = array(); $dropdown = array();
} }
$dropdown_built = array(); $dropdown_built = array();
$op_spacing_needed = FALSE; $op_spacing_needed = FALSE;
@@ -361,7 +361,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
$dropdown_built[$dropdown[$j]] = 'TRUE'; $dropdown_built[$dropdown[$j]] = 'TRUE';
$op_spacing_needed = TRUE; $op_spacing_needed = TRUE;
} }
// garvin: For compatibility's sake, do not let out all other functions. Instead // garvin: For compatibility's sake, do not let out all other functions. Instead
// print a seperator (blank) and then show ALL functions which weren't shown // print a seperator (blank) and then show ALL functions which weren't shown
// yet. // yet.
@@ -451,7 +451,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
echo ' </td>' . "\n"; echo ' </td>' . "\n";
unset($disp); unset($disp);
} }
else if ($cfg['LongtextDoubleTextarea'] && strstr($row_table_def['True_Type'], 'longtext')) { else if ($cfg['LongtextDoubleTextarea'] && strstr($type, 'longtext')) {
?> ?>
<td bgcolor="<?php echo $bgcolor; ?>">&nbsp;</td> <td bgcolor="<?php echo $bgcolor; ?>">&nbsp;</td>
</tr> </tr>
@@ -463,7 +463,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
</td> </td>
<?php <?php
} }
else if (strstr($row_table_def['True_Type'], 'text')) { else if (strstr($type, 'text')) {
?> ?>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?> <?php echo $backup_field . "\n"; ?>
@@ -476,7 +476,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n"; echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
} }
} }
else if (strstr($row_table_def['True_Type'], 'enum')) { else if ($type == 'enum') {
$enum = str_replace('enum(', '', $row_table_def['Type']); $enum = str_replace('enum(', '', $row_table_def['Type']);
$enum = ereg_replace('\\)$', '', $enum); $enum = ereg_replace('\\)$', '', $enum);
$enum = explode('\',\'', substr($enum, 1, -1)); $enum = explode('\',\'', substr($enum, 1, -1));
@@ -537,7 +537,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
<?php <?php
echo "\n"; echo "\n";
} }
else if (strstr($row_table_def['Type'], 'set')) { else if ($type == 'set') {
$set = str_replace('set(', '', $row_table_def['Type']); $set = str_replace('set(', '', $row_table_def['Type']);
$set = ereg_replace('\)$', '', $set); $set = ereg_replace('\)$', '', $set);
$set = explode(',', $set); $set = explode(',', $set);
@@ -625,7 +625,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
if ($is_upload && $is_blob) { if ($is_upload && $is_blob) {
echo '<input type="file" name="fields_upload_' . urlencode($field) . '" class="textfield" id="field_' . $i . '_3" />'; echo '<input type="file" name="fields_upload_' . urlencode($field) . '" class="textfield" id="field_' . $i . '_3" />';
} }
if ($cfg['UploadDir'] != '') { if ($cfg['UploadDir'] != '') {
if ($handle = @opendir($cfg['UploadDir'])) { if ($handle = @opendir($cfg['UploadDir'])) {
$is_first = 0; $is_first = 0;
@@ -650,7 +650,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
echo ' ' . $strWebServerUploadDirectoryError . "\n"; echo ' ' . $strWebServerUploadDirectoryError . "\n";
} }
} // end if (web-server upload directory) } // end if (web-server upload directory)
echo '</td>'; echo '</td>';
} // end else if ( binary or blob) } // end else if ( binary or blob)

View File

@@ -134,14 +134,26 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
$type = '&nbsp;'; $type = '&nbsp;';
} }
$binary = eregi('BINARY', $row['Type'], $test); $binary = eregi('BLOB', $row['Type'], $test) || eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test); $unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test); $zerofill = eregi('ZEROFILL', $row['Type'], $test);
} }
// rabus: Devide charset from the rest of the type definition (MySQL >= 4.1) // rabus: Devide charset from the rest of the type definition (MySQL >= 4.1)
if (strpos($type, ' character set ')) { if (PMA_MYSQL_INT_VERSION >= 40100 && (
list($type, $field_charset) = explode(' character set ', $type); substr($type, 0, 4) == 'char'
|| substr($type, 0, 7) == 'varchar'
|| substr($type, 0, 4) == 'text'
|| substr($type, 0, 8) == 'tinytext'
|| substr($type, 0, 10) == 'mediumtext'
|| substr($type, 0, 8) == 'longtext'
) && !$binary) {
if (strpos($type, ' character set ')) {
$type = substr($type, 0, strpos($type, ' character set '));
}
if (!empty($row['Collation'])) {
$field_charset = $row['Collation'];
}
} }
// garvin: Display basic mimetype [MIME] // garvin: Display basic mimetype [MIME]
@@ -191,7 +203,7 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td> <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
<td bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td> <td bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td bgcolor="' . $bgcolor . '">' . (empty($field_charset) ? '---' : $field_charset) . '</td>' . "\n" : '' ?> <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td bgcolor="' . $bgcolor . '">' . (empty($field_charset) ? '&nbsp;' : $field_charset) . '</td>' . "\n" : '' ?>
<td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td> <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td> <td bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
<td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td> <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
@@ -283,6 +295,7 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
?> ?>
</tr> </tr>
<?php <?php
unset($field_charset);
} // end while } // end while
echo "\n"; echo "\n";
@@ -341,7 +354,7 @@ echo "\n\n";
<br /> <br />
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td> <td valign="top">
<?php <?php
define('PMA_IDX_INCLUDED', 1); define('PMA_IDX_INCLUDED', 1);
require ('./tbl_indexes.php3'); require ('./tbl_indexes.php3');
@@ -488,6 +501,19 @@ if ($cfg['ShowStats']) {
</tr> </tr>
<?php <?php
} }
if (PMA_MYSQL_INT_VERSION >= 40100) {
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
?>
<tr>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCharset; ?></td>
<td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
<?php
echo $showtable['Charset'];
?>
</td>
</tr>
<?php
}
if (!$is_innodb && isset($showtable['Rows'])) { if (!$is_innodb && isset($showtable['Rows'])) {
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']); $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
echo "\n"; echo "\n";