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. the code and the results of the patch #484112.
* sql.php3, lines 92 & 278; tbl_replace.php3, line 130: fixed bug #489770 - * sql.php3, lines 92 & 278; tbl_replace.php3, line 130: fixed bug #489770 -
File name too long in tbl_replace.php. 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> 2001-12-05 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lang/japanese.inc.php3; lang/bulgarian-*.inc.php3: completed thanks to * 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 * Multi-tables printview thanks to Christophe Gesch<63> from the "MySQL Form
* Generator for PHPMyAdmin" (http://sourceforge.net/projects/phpmysqlformgen/) * 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; $the_tables = $selected_tbl;
} else if (isset($table)) { } else if (isset($table)) {
$the_tables[] = $table; $the_tables[] = $table;
@@ -163,11 +163,11 @@ while (list($key, $table) = each($the_tables)) {
$type = $row['Type']; $type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001 // reformat mysql query output - staybyte - 9. June 2001
$shorttype = substr($type, 0, 3); // loic1: set or enum types: slashes single quotes inside options
if ($shorttype == 'set' || $shorttype == 'enu') { if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
$type = eregi_replace(',', ', ', $type); $tmp[2] = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ',');
// Removes automatic MySQL escape format $tmp[2] = substr($tmp[2], 1, -1);
$type = str_replace('\'\'', '\\\'', $type); $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = ''; $type_nowrap = '';
} else { } else {
$type_nowrap = ' nowrap="nowrap"'; $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('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type); $type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type); $type = eregi_replace('UNSIGNED', '', $type);
$length = $type; // set or enum types: slashes single quotes inside options
$type = chop(eregi_replace('\\(.*\\)', '', $type)); if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
if (!empty($type)) { $type = $tmp[1];
$length = eregi_replace("^$type\(", '', $length); $length = ereg_replace('([^,])\'([^,])', '\\1\\\'\\2', ',' . $tmp[2] . ',');
$length = eregi_replace('\)$', '', trim($length)); $length = substr($length, 1, -1);
} } else {
// Removes automatic MySQL escape format $length = $type;
$length = str_replace('\'\'', '\\\'', $length); $type = chop(eregi_replace('\\(.*\\)', '', $type));
if ($length == $type) { if (!empty($type)) {
$length = ''; $length = eregi_replace("^$type\(", '', $length);
} $length = eregi_replace('\)$', '', trim($length));
}
if ($length == $type) {
$length = '';
}
} // end if else
for ($j = 0; $j < count($cfgColumnTypes); $j++) { for ($j = 0; $j < count($cfgColumnTypes); $j++) {
echo ' <option value="'. $cfgColumnTypes[$j] . '"'; echo ' <option value="'. $cfgColumnTypes[$j] . '"';
if (strtoupper($type) == strtoupper($cfgColumnTypes[$j])) { if (strtoupper($type) == strtoupper($cfgColumnTypes[$j])) {
echo ' selected="selected"'; echo ' selected="selected"';
} }
echo ">$cfgColumnTypes[$j]</option>\n"; echo ">$cfgColumnTypes[$j]</option>\n";
} } // end for
?> ?>
</select> </select>
</td> </td>

View File

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