bug #1320470, timestamp is not shown as being NULL under MySQL < 4.1.x

This commit is contained in:
Marc Delisle
2005-10-16 13:00:23 +00:00
parent 40fa1965be
commit 6d4db4249d
3 changed files with 18 additions and 2 deletions

View File

@@ -7,6 +7,9 @@ $Source$
2005-10-16 Marc Delisle <lem9@users.sourceforge.net> 2005-10-16 Marc Delisle <lem9@users.sourceforge.net>
* tbl_create.php: undefined $field_collation under MySQL < 4.1.x * 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 <lem9@users.sourceforge.net> 2005-10-14 Marc Delisle <lem9@users.sourceforge.net>
* libraries/dbi/mysqli.dbi.lib.php: problem under MySQL 4.0.x * libraries/dbi/mysqli.dbi.lib.php: problem under MySQL 4.0.x

View File

@@ -592,6 +592,11 @@ if ($is_minimum_common == FALSE) {
$t_suffix = '_identifier'; $t_suffix = '_identifier';
} else if (($t_next == 'punct_bracket_open_round') } else if (($t_next == 'punct_bracket_open_round')
&& PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_function_name, $PMA_SQPdata_function_name_cnt)) { && 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'; $t_suffix = '_functionName';
} else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_type, $PMA_SQPdata_column_type_cnt)) { } else if (PMA_STR_binarySearchInArr($d_cur_upper, $PMA_SQPdata_column_type, $PMA_SQPdata_column_type_cnt)) {
$t_suffix = '_columnType'; $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']); $upper_data = strtoupper($arr[$i]['data']);
if ($seen_create_table && $in_create_table_fields && isset($current_identifier)) { if ($seen_create_table && $in_create_table_fields && isset($current_identifier)) {
$create_table_fields[$current_identifier]['type'] = $upper_data; $create_table_fields[$current_identifier]['type'] = $upper_data;

View File

@@ -84,8 +84,14 @@ $fields_cnt = PMA_DBI_num_rows($fields_rs);
// but later, if the analyser returns more information, it // but later, if the analyser returns more information, it
// could be executed for any MySQL version and replace // could be executed for any MySQL version and replace
// the info given by SHOW FULL FIELDS FROM. // 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_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1 ); 0, 1 );