From 72f452205e7ec8658b74827320cee5dec0742db8 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 16 Oct 2005 18:48:10 +0000 Subject: [PATCH] bug #1320470, timestamp is not shown as being NULL under MySQL < 4.1.x --- ChangeLog | 5 ++--- tbl_alter.php | 9 +++++++-- tbl_properties_structure.php | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7fc294b5..282503a71 100755 --- a/ChangeLog +++ b/ChangeLog @@ -13,10 +13,9 @@ $Source$ Transformation for SQL pretty printing (RFE #1327648). 2005-10-16 Marc Delisle - * tbl_create.php: undefined $field_collation under MySQL < 4.1.x - * tbl_properties_structure.php, libraries/sqlparser.lib.php: + * tbl_create.php, tbl_alter.php: undefined $field_collation under MySQL < 4.1.x + * tbl_properties_structure.php, tbl_alter.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/tbl_alter.php b/tbl_alter.php index 90be2fce4..db792a978 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -57,7 +57,7 @@ if (isset($do_save_data)) { $query .= ', CHANGE '; } - $query .= PMA_generateAlterTable($field_orig[$i], $field_name[$i], $field_type[$i], $field_length[$i], $field_attribute[$i], $field_collation[$i], $field_null[$i], $field_default[$i], isset($field_default_current_timestamp[$i]), $field_extra[$i], (isset($field_comments[$i]) ? $field_comments[$i] : ''), $field_default_orig[$i]); + $query .= PMA_generateAlterTable($field_orig[$i], $field_name[$i], $field_type[$i], $field_length[$i], $field_attribute[$i], isset($field_collation[$i]) ? $field_collation[$i] : '', $field_null[$i], $field_default[$i], isset($field_default_current_timestamp[$i]), $field_extra[$i], (isset($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 @@ -184,7 +184,12 @@ if ($abort == FALSE) { // TODO: put this code into a require() // or maybe make it part of PMA_DBI_get_fields(); - if (PMA_MYSQL_INT_VERSION >= 40102) { + // 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 >= 32351) { $show_create_table_query = 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table); $show_create_table_res = PMA_DBI_query($show_create_table_query); diff --git a/tbl_properties_structure.php b/tbl_properties_structure.php index e2e84ea9f..91debc0df 100644 --- a/tbl_properties_structure.php +++ b/tbl_properties_structure.php @@ -90,7 +90,6 @@ $fields_cnt = PMA_DBI_num_rows($fields_rs); // 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 >= 32351) { $show_create_table = PMA_DBI_fetch_value( 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),