diff --git a/ChangeLog b/ChangeLog index 00a8fe33d..9dbd79f53 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ $Source$ 2005-10-16 Marc Delisle * tbl_create.php: undefined $field_collation under MySQL < 4.1.x + * tbl_properties_structure.php, libraries/sqlparser.lib.php: + bug #1320470, timestamp is not shown as being NULL under MySQL < 4.1.x + (I still have to fix this bug in tbl_alter.php) 2005-10-14 Marc Delisle * libraries/dbi/mysqli.dbi.lib.php: problem under MySQL 4.0.x diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 663f99f46..a47a1ff6b 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -592,6 +592,11 @@ if ($is_minimum_common == FALSE) { $t_suffix = '_identifier'; } else if (($t_next == 'punct_bracket_open_round') && PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_function_name, $PMA_SQPdata_function_name_cnt)) { + // FIXME-2005-10-16: in the case of a CREATE TABLE containing a TIMESTAMP, + // since TIMESTAMP() is also a function, it's found here and + // the token is wrongly marked as alpha_functionName. But we + // compensate for this when analysing for timestamp_not_null + // later in this script. $t_suffix = '_functionName'; } else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_type, $PMA_SQPdata_column_type_cnt)) { $t_suffix = '_columnType'; @@ -1703,7 +1708,9 @@ if ($is_minimum_common == FALSE) { } } - if (($arr[$i]['type'] == 'alpha_columnType')) { + // note: the "or" part here is a workaround for a bug + // (see FIXME-2005-10-16) + if (($arr[$i]['type'] == 'alpha_columnType') || ($arr[$i]['type'] == 'alpha_functionName' && $seen_create_table)) { $upper_data = strtoupper($arr[$i]['data']); if ($seen_create_table && $in_create_table_fields && isset($current_identifier)) { $create_table_fields[$current_identifier]['type'] = $upper_data; diff --git a/tbl_properties_structure.php b/tbl_properties_structure.php index 861de527b..e2e84ea9f 100644 --- a/tbl_properties_structure.php +++ b/tbl_properties_structure.php @@ -84,8 +84,14 @@ $fields_cnt = PMA_DBI_num_rows($fields_rs); // but later, if the analyser returns more information, it // could be executed for any MySQL version and replace // the info given by SHOW FULL FIELDS FROM. +// +// We also need this to correctly learn if a TIMESTAMP is NOT NULL, since +// SHOW FULL FIELDS says NULL and SHOW CREATE TABLE says NOT NULL (tested +// in MySQL 4.0.25). I was able to find that SHOW CREATE TABLE existed +// at least in MySQL 3.23.51. -if (PMA_MYSQL_INT_VERSION >= 40102) { +//if (PMA_MYSQL_INT_VERSION >= 40102) { +if (PMA_MYSQL_INT_VERSION >= 32351) { $show_create_table = PMA_DBI_fetch_value( 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0, 1 );