Fixed bug #667682 ("UNSIGNED" option in SET or ENUM).

This commit is contained in:
Michal Čihař
2003-01-21 13:57:40 +00:00
parent e485a865ff
commit cac9bb934e
7 changed files with 80 additions and 51 deletions

View File

@@ -5,6 +5,12 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-01-21 Michal Cihar <nijel@users.sourceforge.net>
* db_datadict.php3, pdf_schema.php3, tbl_printview.php3,
tbl_properties.inc.php3, tbl_properties_structure.php3, tbl_select.php3:
Fixed bug #667682 ("UNSIGNED" option in SET or ENUM), SET and ENUM can't
be SIGNED/UNSIGNED/ZEROFILL.
2003-01-19 Alexander M. Turek <rabus@users.sourceforge.net>
* server_privileges.php3: Added column privileges editor.
TODO: Deselection of all columns is not possible yet...

View File

@@ -186,19 +186,22 @@ while ($row = mysql_fetch_array($rowset)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
$type_nowrap = ' nowrap="nowrap"';
}
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
if (empty($type)) {
$type = '&nbsp;';
}
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
}
$strAttribute = '&nbsp;';
if ($binary) {
$strAttribute = 'BINARY';

View File

@@ -1384,9 +1384,12 @@ function PMA_RT_DOC($alltables ){
$tmp[2] = substr(ereg_replace("([^,])''", "\\1\\'", ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$type_nowrap = ' nowrap="nowrap"';
}
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
@@ -1397,6 +1400,7 @@ function PMA_RT_DOC($alltables ){
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
}
$strAttribute = ' ';
if ($binary) {
$strAttribute = 'BINARY';

View File

@@ -204,9 +204,12 @@ while (list($key, $table) = each($the_tables)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$type_nowrap = ' nowrap="nowrap"';
}
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
@@ -217,6 +220,7 @@ while (list($key, $table) = each($the_tables)) {
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
}
$strAttribute = '&nbsp;';
if ($binary) {
$strAttribute = 'BINARY';

View File

@@ -87,14 +87,15 @@ for ($i = 0 ; $i < $num_fields; $i++) {
else {
$type = $row['Type'];
}
$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 = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
} else {
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
$length = $type;
$type = chop(eregi_replace('\\(.*\\)', '', $type));
if (!empty($type)) {
@@ -132,9 +133,15 @@ for ($i = 0 ; $i < $num_fields; $i++) {
<select name="field_attribute[]" id="field_<?php echo $i; ?>_4">
<?php
echo "\n";
if (eregi('^(set|enum)$', $type)) {
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$binary = eregi('BINARY', $row['Type'], $test_attribute1);
$unsigned = eregi('UNSIGNED', $row['Type'], $test_attribute2);
$zerofill = eregi('ZEROFILL', $row['Type'], $test_attribute3);
}
$strAttribute = '';
if ($binary) {
$strAttribute = 'BINARY';

View File

@@ -88,9 +88,12 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$type_nowrap = ' nowrap="nowrap"';
}
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
@@ -101,6 +104,7 @@ while ($row = PMA_mysql_fetch_array($fields_rs)) {
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
}
$strAttribute = '&nbsp;';
if ($binary) {
$strAttribute = 'BINARY';

View File

@@ -52,10 +52,11 @@ if (!isset($param) || $param[0] == '') {
$type = eregi_replace(',', ', ', $type);
// Removes automatic MySQL escape format
$type = str_replace('\'\'', '\\\'', $type);
}
} else {
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
}
if (empty($type)) {
$type = '&nbsp;';
}