diff --git a/ChangeLog b/ChangeLog index 35992c683..bc4464439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ $HeadURL$ - bug #1674914 [structure] changing definition of a TIMESTAMP field - bug #1615530 [upload] added more specific error message if field upload fails - bug #1627210, #1083301, #1482401 [data] warning on duplicate indexes +- bug #1679055 #1050 - Table '' already exists - [gui] avoid displaying a wide selector in server selection + [core] added PMA_fatalError() and made use of it . [i18n] use generic $strOptions @@ -23,6 +24,7 @@ $HeadURL$ + [upload] moved file upload functionality into own class + [upload] make use of $cfg['TempDir'] for file uploads + [server] improved display of binary logs ++ [data] better error handling in tbl_create.php 2.10.1.0 (not released yet) ===================== diff --git a/tbl_create.php b/tbl_create.php index df9aa8e20..1c99836b4 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -1,6 +1,41 @@ = 40100 && !empty($tbl_collation)) { $sql_query .= PMA_generateCharsetQueryPart($tbl_collation); - $query_cpy .= "\n" . PMA_generateCharsetQueryPart($tbl_collation); } if (!empty($comment)) { $sql_query .= ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\''; - $query_cpy .= "\n" . 'COMMENT = \'' . PMA_sqlAddslashes($comment) . '\''; } // Executes the query - $error_create = false; - $result = PMA_DBI_try_query($sql_query) or $error_create = true; + $result = PMA_DBI_try_query($sql_query); - if ($error_create == false) { - $sql_query = $query_cpy . ';'; - unset($query_cpy); - $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated; + if ($result) { // garvin: If comments were sent, enable relation stuff require_once './libraries/relation.lib.php'; @@ -177,8 +205,9 @@ if (isset($submit_num_fields)) { $cfgRelation = PMA_getRelationsParam(); // 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) { + if (isset($field_comments) && is_array($field_comments) + && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { + foreach ($field_comments as $fieldindex => $fieldcomment) { if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) { PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); } @@ -186,53 +215,54 @@ 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) { + if (isset($field_mimetype) && is_array($field_mimetype) + && $cfgRelation['commwork'] && $cfgRelation['mimework'] + && $cfg['BrowseMIME']) { + foreach ($field_mimetype as $fieldindex => $mimetype) { if (isset($field_name[$fieldindex]) && strlen($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']; - $abort = true; - exit(); + $message = $strTable . ' ' + . htmlspecialchars(PMA_backquote($db) . '.' . PMA_backquote($table)) + . ' ' . $strHasBeenCreated; + $display_query = $sql_query; + unset($sql_query); + + // do not switch to sql.php - as there is no row to be displayed on a new table + if ($cfg['DefaultTabTable'] === 'sql.php') { + require './tbl_structure.php'; + } else { + require './' . $cfg['DefaultTabTable']; + } + exit; } else { PMA_mysqlDie('', '', '', $err_url, false); // garvin: An error happened while inserting/updating a table definition. // to prevent total loss of that data, we embed the form once again. // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php $num_fields = $orig_num_fields; - $regenerate = true; } } // end do create table /** * Displays the form used to define the structure of the table */ -if ($abort == false) { - if (isset($num_fields)) { - $num_fields = intval($num_fields); - } - // No table name - if (!isset($table) || trim($table) == '') { - PMA_mysqlDie($strTableEmpty, '', '', $err_url); - } - // No valid number of fields - elseif (empty($num_fields) || !is_int($num_fields)) { - PMA_mysqlDie($strFieldsEmpty, '', '', $err_url); - } - // Does table exist? - elseif (!(PMA_DBI_get_fields($db, $table) === false)) { - PMA_mysqlDie(sprintf($strTableAlreadyExists, htmlspecialchars($table)), '', '', $err_url); - } - // Table name and number of fields are valid -> show the form - else { - $action = 'tbl_create.php'; - require './libraries/tbl_properties.inc.php'; - // Displays the footer - require_once './libraries/footer.inc.php'; - } +// check number of fields to be created +if (isset($_REQUEST['submit_num_fields'])) { + $num_fields = $_REQUEST['orig_num_fields'] + $_REQUEST['added_fields']; +} elseif (isset($_REQUEST['num_fields']) && intval($_REQUEST['num_fields']) > 0) { + $num_fields = (int) $_REQUEST['num_fields']; +} else { + $num_fields = 1; } +$action = 'tbl_create.php'; +require './libraries/tbl_properties.inc.php'; +// Displays the footer +require_once './libraries/footer.inc.php'; ?>