From db219629d94ba0d4271352a3b112595e6fa45e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 8 Oct 2005 17:33:20 +0000 Subject: [PATCH] Do not try to set comment and MIME transformation if field not named. --- ChangeLog | 3 +++ tbl_addfield.php | 8 ++++++-- tbl_alter.php | 8 ++++++-- tbl_create.php | 5 +++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e45f011a9..0a85d2f96 100755 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,9 @@ $Source$ libraries/common.lib.php, libraries/relation.lib.php: Use common code for CREATE/ALTER TABLE, set comments on creating table, so that user can see it in the query. + * tbl_addfield.php, tbl_alter.php, tbl_create.php: Do not try to set + comment and MIME transformation if field not named. + 2005-10-07 Marc Delisle * libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a diff --git a/tbl_addfield.php b/tbl_addfield.php index b00c441e7..aa76e2779 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -166,14 +166,18 @@ if (isset($submit_num_fields)) { // garvin: Update comment table, if a comment was set. if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { foreach ($field_comments AS $fieldindex => $fieldcomment) { - PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); + if (!empty($field_name[$fieldindex])) { + PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); + } } } // garvin: Update comment table for mime types [MIME] if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { foreach ($field_mimetype AS $fieldindex => $mimetype) { - PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + if (!empty($field_name[$fieldindex])) { + PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + } } } diff --git a/tbl_alter.php b/tbl_alter.php index db5b6cc9a..61e53132a 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -82,7 +82,9 @@ if (isset($do_save_data)) { // garvin: Update comment table, if a comment was set. if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) { foreach ($field_comments AS $fieldindex => $fieldcomment) { - PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb'); + if (!empty($field_name[$fieldindex])) { + PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb'); + } } } @@ -127,7 +129,9 @@ if (isset($do_save_data)) { // garvin: Update comment table for mime types [MIME] if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { foreach ($field_mimetype AS $fieldindex => $mimetype) { - PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + if (!empty($field_name[$fieldindex])) { + PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + } } } diff --git a/tbl_create.php b/tbl_create.php index 4768f1ecd..43ef5946a 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -179,7 +179,6 @@ if (isset($submit_num_fields)) { // garvin: Update comment table, if a comment was set. if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { foreach ($field_comments AS $fieldindex => $fieldcomment) { - // do not try to set a comment if the field name is empty if (!empty($field_name[$fieldindex])) { PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); } @@ -189,7 +188,9 @@ if (isset($submit_num_fields)) { // garvin: Update comment table for mime types [MIME] if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { foreach ($field_mimetype AS $fieldindex => $mimetype) { - PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + if (!empty($field_name[$fieldindex])) { + PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); + } } }