bug #1262250, cannot change ENUM default value to empty
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2005-09-28 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* tbl_alter.php, libraries/common.lib.php, /relation.lib.php:
|
||||
bug #1262250, cannot change ENUM default value to empty
|
||||
|
||||
2005-09-27 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||
* libraries/sql_query_form.lib.php: removed unneeded variable,
|
||||
dont display bookmark selection fieldset if no bookmark exists
|
||||
|
@@ -2737,7 +2737,7 @@ if (typeof(document.getElementById) != 'undefined'
|
||||
} // end function
|
||||
|
||||
|
||||
function PMA_generateAlterTable($oldcol, $newcol, $full_field_type, $collation, $null, $default, $default_current_timestamp, $extra, $comment='') {
|
||||
function PMA_generateAlterTable($oldcol, $newcol, $full_field_type, $collation, $null, $default, $default_current_timestamp, $extra, $comment='', $default_orig) {
|
||||
|
||||
// $default_current_timestamp has priority over $default
|
||||
// TODO: on the interface, some js to clear the default value
|
||||
@@ -2758,7 +2758,7 @@ if (typeof(document.getElementById) != 'undefined'
|
||||
if ($default_current_timestamp && strpos(' ' . strtoupper($full_field_type),'TIMESTAMP') == 1) {
|
||||
$query .= ' DEFAULT CURRENT_TIMESTAMP';
|
||||
// 0 is empty in PHP
|
||||
} elseif (!empty($default) || $default == '0') {
|
||||
} elseif (!empty($default) || $default == '0' || $default != $default_orig) {
|
||||
if (strtoupper($default) == 'NULL') {
|
||||
$query .= ' DEFAULT NULL';
|
||||
} else {
|
||||
|
@@ -611,7 +611,7 @@ function PMA_setComment($db, $table, $col, $comment, $removekey = '', $mode='aut
|
||||
}
|
||||
|
||||
$query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE '
|
||||
. PMA_generateAlterTable($col, $col, $types[$col], $collations[$col], $nulls[$col], $defaults[$col], $default_current_timestamps[$col], $extras[$col], $comment);
|
||||
. PMA_generateAlterTable($col, $col, $types[$col], $collations[$col], $nulls[$col], $defaults[$col], $default_current_timestamps[$col], $extras[$col], $comment, '');
|
||||
|
||||
PMA_DBI_try_query($query, NULL, PMA_DBI_QUERY_STORE);
|
||||
return TRUE;
|
||||
|
@@ -67,7 +67,7 @@ if (isset($do_save_data)) {
|
||||
}
|
||||
// take care of native MySQL comments here
|
||||
|
||||
$query .= PMA_generateAlterTable($field_orig[$i], $field_name[$i], $full_field_type, (PMA_MYSQL_INT_VERSION >= 40100 && $field_collation[$i] != '' ? $field_collation[$i] : ''), $field_null[$i], $field_default[$i], (isset($field_default_current_timestamp[$i]) ? $field_default_current_timestamp[$i] : ''), $field_extra[$i], (PMA_MYSQL_INT_VERSION >= 40100 && isset($field_comments[$i]) && $field_comments[$i] != '' ? $field_comments[$i] : ''));
|
||||
$query .= PMA_generateAlterTable($field_orig[$i], $field_name[$i], $full_field_type, (PMA_MYSQL_INT_VERSION >= 40100 && $field_collation[$i] != '' ? $field_collation[$i] : ''), $field_null[$i], $field_default[$i], (isset($field_default_current_timestamp[$i]) ? $field_default_current_timestamp[$i] : ''), $field_extra[$i], (PMA_MYSQL_INT_VERSION >= 40100 && isset($field_comments[$i]) && $field_comments[$i] != '' ? $field_comments[$i] : ''), $field_default_orig[$i]);
|
||||
} // end for
|
||||
|
||||
// To allow replication, we first select the db to use and then run queries
|
||||
|
Reference in New Issue
Block a user