[Phpmyadmin-devel] Bug #449858, Error Changing Column DataType
Ignacio Vazquez-Abrams
ignacio at openservices.net
Sat Aug 11 05:49:13 CEST 2001
On Fri, 10 Aug 2001, Robin Johnson wrote:
> It looks like it should work, just test it and check it in to CVS if it
> works fine. (I'm getting ready to go to a party)
Actually, here's a better patch. Instead of just rejecting an entered length,
it puts "N/A" in place of the text input.
It tested okay, so it seems alright to apply. Feel free to verify this,
somebody please.
--
Ignacio Vazquez-Abrams <ignacio at openservices.net>
-------------- next part --------------
--- tbl_alter.php3.orig Fri Aug 10 18:44:28 2001
+++ tbl_alter.php3 Fri Aug 10 18:48:28 2001
@@ -28,9 +28,27 @@
$query = '';
}
$query .= ' ' . backquote($field_orig[0]) . ' ' . backquote($field_name[0]) . ' ' . $field_type[0] . ' ';
- if ($field_length[0] != '') {
- $query .= '(' . $field_length[0] . ') ';
- }
+ // Some field types shouldn't have lengths
+ switch (strtoupper($field_type[0]))
+ {
+ case 'DATE':
+ case 'DATETIME':
+ case 'TIME':
+ case 'TINYBLOB':
+ case 'TINYTEXT':
+ case 'BLOB':
+ case 'TEXT':
+ case 'MEDIUMBLOB':
+ case 'MEDIUMTEXT':
+ case 'LONGBLOB':
+ case 'LONGTEXT':
+ break;
+
+ default:
+ if ($field_length[0] != '') {
+ $query .= '(' . $field_length[0] . ') ';
+ };
+ };
if ($field_attribute[0] != '') {
$query .= $field_attribute[0] . ' ';
}
--- tbl_properties.inc.php3.orig Fri Aug 10 22:17:02 2001
+++ tbl_properties.inc.php3 Fri Aug 10 22:22:31 2001
@@ -99,7 +99,32 @@
</select>
</td>
<td>
- <input type="text" name="field_length[]" size="8" value="<?php echo $length; ?>" />
+<?php
+// Some field types shouldn't have lengths
+ switch (strtoupper($type))
+ {
+ case 'DATE':
+ case 'DATETIME':
+ case 'TIME':
+ case 'TINYBLOB':
+ case 'TINYTEXT':
+ case 'BLOB':
+ case 'TEXT':
+ case 'MEDIUMBLOB':
+ case 'MEDIUMTEXT':
+ case 'LONGBLOB':
+ case 'LONGTEXT':
+ $fieldlengthtype="hidden";
+ $fieldlengthalt="<center>N/A</center>";
+ break;
+
+ default:
+ $fieldlengthtype="text";
+ $fieldlengthalt="";
+ };
+?>
+ <input type="<?php echo $fieldlengthtype; ?>" name="field_length[]" size="8" value="<?php echo $length; ?>" />
+ <?php echo $fieldlengthalt; ?>
</td>
<td>
<select name="field_attribute[]">
More information about the Developers
mailing list