Do not try to set comment and MIME transformation if field not named.

This commit is contained in:
Michal Čihař
2005-10-08 17:33:20 +00:00
parent c62f975a47
commit db219629d9
4 changed files with 18 additions and 6 deletions

View File

@@ -47,6 +47,9 @@ $Source$
libraries/common.lib.php, libraries/relation.lib.php: Use common code libraries/common.lib.php, libraries/relation.lib.php: Use common code
for CREATE/ALTER TABLE, set comments on creating table, so that user can for CREATE/ALTER TABLE, set comments on creating table, so that user can
see it in the query. 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 <lem9@users.sourceforge.net> 2005-10-07 Marc Delisle <lem9@users.sourceforge.net>
* libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a * libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a

View File

@@ -166,16 +166,20 @@ if (isset($submit_num_fields)) {
// garvin: Update comment table, if a comment was set. // garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
foreach ($field_comments AS $fieldindex => $fieldcomment) { foreach ($field_comments AS $fieldindex => $fieldcomment) {
if (!empty($field_name[$fieldindex])) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
} }
} }
}
// garvin: Update comment table for mime types [MIME] // garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
foreach ($field_mimetype AS $fieldindex => $mimetype) { foreach ($field_mimetype AS $fieldindex => $mimetype) {
if (!empty($field_name[$fieldindex])) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
} }
} }
}
// Go back to the structure sub-page // Go back to the structure sub-page
$sql_query = $sql_query_cpy; $sql_query = $sql_query_cpy;

View File

@@ -82,9 +82,11 @@ if (isset($do_save_data)) {
// garvin: Update comment table, if a comment was set. // garvin: Update comment table, if a comment was set.
if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) { if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
foreach ($field_comments AS $fieldindex => $fieldcomment) { foreach ($field_comments AS $fieldindex => $fieldcomment) {
if (!empty($field_name[$fieldindex])) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb'); PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb');
} }
} }
}
// garvin: Rename relations&display fields, if altered. // garvin: Rename relations&display fields, if altered.
if (($cfgRelation['displaywork'] || $cfgRelation['relwork']) && isset($field_orig) && is_array($field_orig)) { if (($cfgRelation['displaywork'] || $cfgRelation['relwork']) && isset($field_orig) && is_array($field_orig)) {
@@ -127,9 +129,11 @@ if (isset($do_save_data)) {
// garvin: Update comment table for mime types [MIME] // garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
foreach ($field_mimetype AS $fieldindex => $mimetype) { foreach ($field_mimetype AS $fieldindex => $mimetype) {
if (!empty($field_name[$fieldindex])) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
} }
} }
}
$active_page = 'tbl_properties_structure.php'; $active_page = 'tbl_properties_structure.php';
require('./tbl_properties_structure.php'); require('./tbl_properties_structure.php');

View File

@@ -179,7 +179,6 @@ if (isset($submit_num_fields)) {
// garvin: Update comment table, if a comment was set. // garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) {
foreach ($field_comments AS $fieldindex => $fieldcomment) { foreach ($field_comments AS $fieldindex => $fieldcomment) {
// do not try to set a comment if the field name is empty
if (!empty($field_name[$fieldindex])) { if (!empty($field_name[$fieldindex])) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb');
} }
@@ -189,9 +188,11 @@ if (isset($submit_num_fields)) {
// garvin: Update comment table for mime types [MIME] // garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
foreach ($field_mimetype AS $fieldindex => $mimetype) { foreach ($field_mimetype AS $fieldindex => $mimetype) {
if (!empty($field_name[$fieldindex])) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]); PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
} }
} }
}
require('./' . $cfg['DefaultTabTable']); require('./' . $cfg['DefaultTabTable']);
$abort = TRUE; $abort = TRUE;