diff --git a/htdocs/sql/tbl_create.php b/htdocs/sql/tbl_create.php new file mode 100755 --- /dev/null +++ b/htdocs/sql/tbl_create.php @@ -0,0 +1,269 @@ += 40100 && !empty($tbl_collation)) { + $sql_query .= PMA_generateCharsetQueryPart($tbl_collation); + } + + if (!empty($comment)) { + $sql_query .= ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\''; + } + + // Executes the query + $result = PMA_DBI_try_query($sql_query); + + if ($result) { + + // garvin: If comments were sent, enable relation stuff + require_once './libraries/relation.lib.php'; + require_once './libraries/transformations.lib.php'; + + $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_name[$fieldindex]) && strlen($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) { + if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) { + PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, + $field_transformation[$fieldindex], + $field_transformation_options[$fieldindex]); + } + } + } + + $message = $strTable . ' ' + . htmlspecialchars(PMA_backquote($db) . '.' . PMA_backquote($table)) + . ' ' . $strHasBeenCreated; + $display_query = $sql_query; + $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; + } +} // end do create table + +/** + * Displays the form used to define the structure of the table + */ +// check number of fields to be created +if (isset($_REQUEST['submit_num_fields'])) { + $regenerate = true; // for libraries/tbl_properties.inc.php + $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'; +?>