diff --git a/ChangeLog b/ChangeLog index f14c92405..bb63185c7 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-04-01 Marc Delisle + * tbl_addfield.php: TIMESTAMP options support + 2005-03-31 Alexander M. Turek * left.php: Undefined offset (Bug #1174045). @@ -15,7 +18,6 @@ $Source$ * tbl_properties.inc.php: TIMESTAMP default CURRENT_TIMESTAMP checkbox made dynamic, depending on the field's type * tbl_create.php, libraries/relation.lib.php: TIMESTAMP options support - TODO: (work in progress) support those options in tbl_addfield 2005-03-30 Alexander M. Turek * server_databases.php: Bug #1172782 (Don't allow to drop @@ -31,8 +33,7 @@ $Source$ where still untranslated * tbl_properties.inc.php: bug #1163595 (problem #5): after an error modifying TIMESTAMP options, the table structure editing form - was shown without the new options. Still having an issue with - a default value for a TIMESTAMP not generated in the ALTER TABLE. + was shown without the new options. 2005-03-29 Marc Delisle * libraries/common.lib.php: XSS vulnerability on convcharset diff --git a/tbl_addfield.php b/tbl_addfield.php index 541dd1b9c..8c25a2831 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -50,8 +50,13 @@ if (isset($submit_num_fields)) { } // end if } // end for // Builds the field creation statement and alters the table + + // TODO: check to see if this logic is exactly the same + // as in tbl_create.php, and move to an include file + for ($i = 0; $i < $field_cnt; ++$i) { - if (empty($field_name[$i])) { + // '0' is also empty for php :-( + if (empty($field_name[$i]) && $field_name[$i] != '0') { continue; } @@ -67,7 +72,10 @@ if (isset($submit_num_fields)) { $query .= ' CHARACTER SET ' . $tmp_charset . ' COLLATE ' . $field_collation[$i]; unset($tmp_charset); } - if ($field_default[$i] != '') { + + if (isset($field_default_current_timestamp[$i]) && $field_default_current_timestamp[$i]) { + $query .= ' DEFAULT CURRENT_TIMESTAMP'; + } elseif ($field_default[$i] != '') { if (strtoupper($field_default[$i]) == 'NULL') { $query .= ' DEFAULT NULL'; } else {