fixed bug #489440 - enum fields in tbl_properties.php

This commit is contained in:
Loïc Chapeaux
2001-12-06 21:10:53 +00:00
parent 8f05aa6be7
commit 351b5b350c
4 changed files with 31 additions and 23 deletions

View File

@@ -10,6 +10,8 @@ $Source$
the code and the results of the patch #484112.
* sql.php3, lines 92 & 278; tbl_replace.php3, line 130: fixed bug #489770 -
File name too long in tbl_replace.php.
* tbl_printview.php3; tbl_properties.php3; tbl_properties.inc.php3: fixed
bug #489440 - enum fields in tbl_properties.php.
2001-12-05 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lang/japanese.inc.php3; lang/bulgarian-*.inc.php3: completed thanks to

View File

@@ -38,7 +38,7 @@ mysql_select_db($db);
* Multi-tables printview thanks to Christophe Gesch<63> from the "MySQL Form
* Generator for PHPMyAdmin" (http://sourceforge.net/projects/phpmysqlformgen/)
*/
if (is_array($selected_tbl)) {
if (isset($selected_tbl) && is_array($selected_tbl)) {
$the_tables = $selected_tbl;
} else if (isset($table)) {
$the_tables[] = $table;
@@ -163,11 +163,11 @@ while (list($key, $table) = each($the_tables)) {
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
$shorttype = substr($type, 0, 3);
if ($shorttype == 'set' || $shorttype == 'enu') {
$type = eregi_replace(',', ', ', $type);
// Removes automatic MySQL escape format
$type = str_replace('\'\'', '\\\'', $type);
// loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
$tmp[2] = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ',');
$tmp[2] = substr($tmp[2], 1, -1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
} else {
$type_nowrap = ' nowrap="nowrap"';

View File

@@ -87,24 +87,30 @@ for ($i = 0 ; $i < $num_fields; $i++) {
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
// set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
$type = $tmp[1];
$length = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ',');
$length = substr($length, 1, -1);
} else {
$length = $type;
$type = chop(eregi_replace('\\(.*\\)', '', $type));
if (!empty($type)) {
$length = eregi_replace("^$type\(", '', $length);
$length = eregi_replace('\)$', '', trim($length));
}
// Removes automatic MySQL escape format
$length = str_replace('\'\'', '\\\'', $length);
if ($length == $type) {
$length = '';
}
} // end if else
for ($j = 0; $j < count($cfgColumnTypes); $j++) {
echo ' <option value="'. $cfgColumnTypes[$j] . '"';
if (strtoupper($type) == strtoupper($cfgColumnTypes[$j])) {
echo ' selected="selected"';
}
echo ">$cfgColumnTypes[$j]</option>\n";
}
} // end for
?>
</select>
</td>

View File

@@ -253,11 +253,11 @@ while ($row = mysql_fetch_array($fields_rs)) {
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
$shorttype = substr($type, 0, 3);
if ($shorttype == 'set' || $shorttype == 'enu') {
$type = eregi_replace(',', ', ', $type);
// Removes automatic MySQL escape format
$type = str_replace('\'\'', '\\\'', $type);
// loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
$tmp[2] = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ',');
$tmp[2] = substr($tmp[2], 1, -1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
} else {
$type_nowrap = ' nowrap="nowrap"';