Do not waste the data for table-field creation, if MySQL shows an error.

Instead, give the user the opportunity to fix the errors and display the
form again.
This commit is contained in:
Garvin Hicking
2003-03-10 18:56:48 +00:00
parent 42aa76e0e0
commit 3ae253e400
6 changed files with 325 additions and 167 deletions

View File

@@ -14,9 +14,9 @@ $Source$
* sql.php3: Fixed another occurence of addslashes() where it no longer
belongs.
* tbl_addfield.php3, tbl_alter.php3, tbl_create.php3,
tbl_properties.inc.php3: Goodie for you all - when creating/altering/
adding table fields you can now change the wrong form input, instead
of losing all your data. Have fun. :-)
tbl_properties.inc.php3, libraries/common.lib.php3: Goodie for you all
- when creating/altering/adding table fields you can now change the
wrong form input, instead of losing all your data. Have fun. :-)
* tbl_dump.php3, tbl_properties_export.php3, css/phpmyadmin.css.php3,
lang/*:
Added new table export format by Michal Cihar. db_details_export.php3

View File

@@ -399,13 +399,15 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
* @param string the sql query that failed
* @param boolean whether to show a "modify" link or not
* @param string the "back" link url (full path is not required)
* @param boolean EXIT the page?
*
* @global array the configuration array
*
* @access public
*/
function PMA_mysqlDie($error_message = '', $the_query = '',
$is_modify_link = TRUE, $back_url = '')
$is_modify_link = TRUE, $back_url = '',
$exit = TRUE)
{
global $cfg;
@@ -466,13 +468,15 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
. '</pre>' . "\n";
if (!empty($back_url)) {
if (!empty($back_url) && $exit) {
echo '<a href="' . $back_url . '">' . $GLOBALS['strBack'] . '</a>';
}
echo "\n";
include('./footer.inc.php3');
exit();
if ($exit) {
include('./footer.inc.php3');
exit();
}
} // end of the 'PMA_mysqlDie()' function

View File

@@ -20,6 +20,7 @@ $err_url = 'tbl_properties.php3?' . PMA_generate_common_url($db, $table);
/**
* The form used to define the field to add has been submitted
*/
$abort = false;
if (isset($submit)) {
$query = '';
@@ -101,114 +102,129 @@ if (isset($submit)) {
$sql_query = 'USE ' . PMA_backquote($db);
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD ' . $query;
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy = $sql_query . ';';
$error_create = false;
$result = PMA_mysql_query($sql_query) or $error_create = true;
// Builds the primary keys statements and updates the table
$primary = '';
if (isset($field_primary)) {
$primary_cnt = count($field_primary);
for ($i = 0; $i < $primary_cnt; $i++) {
$j = $field_primary[$i];
if (!empty($field_name[$j])) {
$primary .= PMA_backquote($field_name[$j]) . ', ';
if ($error_create == false) {
$sql_query_cpy = $sql_query . ';';
// Builds the primary keys statements and updates the table
$primary = '';
if (isset($field_primary)) {
$primary_cnt = count($field_primary);
for ($i = 0; $i < $primary_cnt; $i++) {
$j = $field_primary[$i];
if (!empty($field_name[$j])) {
$primary .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$primary = ereg_replace(', $', '', $primary);
if (!empty($primary)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end for
$primary = ereg_replace(', $', '', $primary);
if (!empty($primary)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
// Builds the indexes statements and updates the table
$index = '';
if (isset($field_index)) {
$index_cnt = count($field_index);
for ($i = 0; $i < $index_cnt; $i++) {
$j = $field_index[$i];
if (!empty($field_name[$j])) {
$index .= PMA_backquote($field_name[$j]) . ', ';
} // end if
// Builds the indexes statements and updates the table
$index = '';
if (isset($field_index)) {
$index_cnt = count($field_index);
for ($i = 0; $i < $index_cnt; $i++) {
$j = $field_index[$i];
if (!empty($field_name[$j])) {
$index .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$index = ereg_replace(', $', '', $index);
if (!empty($index)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end for
$index = ereg_replace(', $', '', $index);
if (!empty($index)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
// Builds the uniques statements and updates the table
$unique = '';
if (isset($field_unique)) {
$unique_cnt = count($field_unique);
for ($i = 0; $i < $unique_cnt; $i++) {
$j = $field_unique[$i];
if (!empty($field_name[$j])) {
$unique .= PMA_backquote($field_name[$j]) . ', ';
} // end if
// Builds the uniques statements and updates the table
$unique = '';
if (isset($field_unique)) {
$unique_cnt = count($field_unique);
for ($i = 0; $i < $unique_cnt; $i++) {
$j = $field_unique[$i];
if (!empty($field_name[$j])) {
$unique .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
$unique = ereg_replace(', $', '', $unique);
if (!empty($unique)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
// Builds the fulltext statements and updates the table
$fulltext = '';
if (PMA_MYSQL_INT_VERSION >= 32323 && isset($field_fulltext)) {
$fulltext_cnt = count($field_fulltext);
for ($i = 0; $i < $fulltext_cnt; $i++) {
$j = $field_fulltext[$i];
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$fulltext = ereg_replace(', $', '', $fulltext);
if (!empty($fulltext)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment);
}
} // end for
$unique = ereg_replace(', $', '', $unique);
if (!empty($unique)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
}
} // end if
// Builds the fulltext statements and updates the table
$fulltext = '';
if (PMA_MYSQL_INT_VERSION >= 32323 && isset($field_fulltext)) {
$fulltext_cnt = count($field_fulltext);
for ($i = 0; $i < $fulltext_cnt; $i++) {
$j = $field_fulltext[$i];
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
} // end for
$fulltext = ereg_replace(', $', '', $fulltext);
if (!empty($fulltext)) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query_cpy .= "\n" . $sql_query . ';';
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
}
}
} // end if
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment);
// Go back to the structure sub-page
$sql_query = $sql_query_cpy;
unset($sql_query_cpy);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
include('./tbl_properties_structure.php3');
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 tbl_properties.inc.php3
$num_fields = $orig_num_fields;
if (isset($orig_after_field)) {
$after_field = $orig_after_field;
}
$regenerate = true;
}
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
}
}
// Go back to the structure sub-page
$sql_query = $sql_query_cpy;
unset($sql_query_cpy);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
include('./tbl_properties_structure.php3');
exit();
} // end do alter table
/**
* Displays the form used to define the new field
*/
else{
if ($abort == FALSE) {
$action = 'tbl_addfield.php3';
include('./tbl_properties.inc.php3');

View File

@@ -22,6 +22,7 @@ $err_url = 'tbl_properties_structure.php3?' . PMA_generate_common_url($db, $tabl
/**
* Modifications have been submitted -> updates the table
*/
$abort = false;
if (isset($submit)) {
$field_cnt = count($field_orig);
for ($i = 0; $i < $field_cnt; $i++) {
@@ -78,41 +79,54 @@ if (isset($submit)) {
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
// Optimization fix - 2 May 2001 - Robbat2
$sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE ' . $query;
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
$btnDrop = 'Fake';
$error_create = false;
$result = PMA_mysql_query($sql_query) or $error_create = true;
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
if ($error_create == false) {
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
$btnDrop = 'Fake';
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex]);
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex]);
}
}
}
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
}
}
include('./tbl_properties_structure.php3');
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 tbl_properties.inc.php3
if (isset($orig_field)) {
$field = $orig_field;
}
}
include('./tbl_properties_structure.php3');
exit();
$regenerate = true;
}
}
/**
* No modifications yet required -> displays the table fields
*/
else {
if ($abort == FALSE) {
if (!isset($selected)) {
$selected[] = $field;
$selected_cnt = 1;

View File

@@ -26,6 +26,7 @@ PMA_mysql_select_db($db);
/**
* The form used to define the structure of the table has been submitted
*/
$abort = false;
if (isset($submit)) {
$sql_query = $query_cpy = '';
@@ -141,7 +142,7 @@ if (isset($submit)) {
$fulltext .= PMA_backquote($field_name[$j]) . ', ';
}
} // end for
unset($field_fulltext);
$fulltext = ereg_replace(', $', '', $fulltext);
if (!empty($fulltext)) {
$sql_query .= ', FULLTEXT (' . $fulltext . ')';
@@ -164,42 +165,53 @@ if (isset($submit)) {
}
// Executes the query
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
$sql_query = $query_cpy . ';';
unset($query_cpy);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
$error_create = false;
$result = PMA_mysql_query($sql_query) or $error_create = true;
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment);
if ($error_create == false) {
$sql_query = $query_cpy . ';';
unset($query_cpy);
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
// garvin: If comments were sent, enable relation stuff
require('./libraries/relation.lib.php3');
require('./libraries/transformations.lib.php3');
$cfgRelation = PMA_getRelationsParam();
// garvin: Update comment table, if a comment was set.
if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) {
@reset($field_comments);
while(list($fieldindex, $fieldcomment) = each($field_comments)) {
PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment);
}
}
}
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
// garvin: Update comment table for mime types [MIME]
if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
@reset($field_mimetype);
while(list($fieldindex, $mimetype) = each($field_mimetype)) {
PMA_setMIME($db, $table, $field_name[$fieldindex], $mimetype, $field_transformation[$fieldindex], $field_transformation_options[$fieldindex]);
}
}
include('./' . $cfg['DefaultTabTable']);
$abort = TRUE;
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 tbl_properties.inc.php3
$num_fields = $orig_num_fields;
$regenerate = true;
}
include('./' . $cfg['DefaultTabTable']);
exit();
} // end do create table
/**
* Displays the form used to define the structure of the table
*/
else {
if ($abort == FALSE) {
if (isset($num_fields)) {
$num_fields = intval($num_fields);
}

View File

@@ -26,6 +26,49 @@ else if ($action == 'tbl_addfield.php3') {
<?php
}
echo "\n";
if (isset($num_fields)) {
?>
<input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
<?php
}
if (isset($after_field)) {
?>
<input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
<?php
}
if (isset($selected) && is_array($selected)) {
@reset($selected);
while(list($o_fld_nr, $o_fld_val) = each($selected)) {
?>
<input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php
if (!isset($true_selected)) {
?>
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php
}
}
if (isset($true_selected) && is_array($true_selected)) {
@reset($true_selected);
while(list($o_fld_nr, $o_fld_val) = each($true_selected)) {
?>
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php
}
}
} elseif (isset($field)) {
?>
<input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
<input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
<?php
}
$is_backup = ($action != 'tbl_create.php3' && $action != 'tbl_addfield.php3');
$header_cells = array();
@@ -74,17 +117,74 @@ if (!$is_backup) {
$header_cells[] = $strIdxFulltext;
}
// garvin: workaround for field_fulltext, because its submitted indizes contain
// the index as a value, not a key. Inserted here for easier maintaineance
// and less code to change in existing files.
if (isset($field_fulltext) && is_array($field_fulltext)) {
@reset($field_fulltext);
while(list($fulltext_nr, $fulltext_indexkey) = each($field_fulltext)) {
$submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
}
}
for ($i = 0 ; $i < $num_fields; $i++) {
if (isset($fields_meta)) {
$submit_null = FALSE;
if (isset($regenerate) && $regenerate == TRUE) {
// An error happened with previous inputs, so we will restore the data
// to embed it once again in this form.
$row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
$row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
$row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
if ($row['Null'] == '') {
$submit_null = TRUE;
}
if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
$row['Key'] = 'PRI';
} elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
$row['Key'] = 'MUL';
} elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
$row['Key'] = 'UNI';
} else {
$row['Key'] = '';
}
$row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
$row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
$row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
$submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
$submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
if (isset($field_comments) && isset($field_comments[$i])) {
$comments_map[$row['Field']] = $field_comments[$i];
}
if (isset($field_mimetype) && isset($field_mimetype[$i])) {
$mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
}
if (isset($field_transformation) && isset($field_transformation[$i])) {
$mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
}
if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
$mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
}
} elseif (isset($fields_meta)) {
$row = $fields_meta[$i];
}
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
// Cell index: If certain fields get left out, the counter shouldn't chage.
$ci = 0;
if ($is_backup) {
$content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : '') . '" />' . "\n";
$backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
$content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
} else {
$content_cells[$i][$ci] = '';
}
@@ -119,6 +219,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
$length = '';
}
} // end if else
if (isset($submit_length) && $submit_length != FALSE) {
$length = $submit_length;
}
for ($j = 0; $j < count($cfg['ColumnTypes']); $j++) {
$content_cells[$i][$ci] .= ' <option value="'. $cfg['ColumnTypes'][$j] . '"';
@@ -161,6 +265,11 @@ for ($i = 0 ; $i < $num_fields; $i++) {
if ($zerofill) {
$strAttribute = 'UNSIGNED ZEROFILL';
}
if (isset($submit_attribute) && $submit_attribute != FALSE) {
$strAttribute = $submit_attribute;
}
for ($j = 0;$j < count($cfg['AttributeTypes']); $j++) {
$content_cells[$i][3] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
@@ -174,7 +283,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
$content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_5">';
if (!isset($row) || empty($row['Null'])) {
if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
$content_cells[$i][$ci] .= "\n";
$content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
$content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
@@ -277,7 +386,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
&& empty($checked_index)
&& empty($checked_unique)) {
$checked_none = ' checked="checked"';
} else {
$checked_none = '';
}
if (PMA_MYSQL_INT_VERSION >= 32323
&&(isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
$checked_fulltext = ' checked="checked"';
@@ -384,7 +496,7 @@ if ($action == 'tbl_create.php3' && PMA_MYSQL_INT_VERSION >= 32300) {
</tr>
<tr>
<td>
<input type="text" name="comment" size="40" maxlength="80" class="textfield" />
<input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
</td>
<?php
// BEGIN - Table Type - 2 May 2001 - Robbat2
@@ -428,14 +540,14 @@ if ($action == 'tbl_create.php3' && PMA_MYSQL_INT_VERSION >= 32300) {
<td width="25">&nbsp;</td>
<td>
<select name="tbl_type">
<option value="Default"><?php echo $strDefault; ?></option>
<option value="MYISAM">MyISAM</option>
<option value="HEAP">Heap</option>
<option value="MERGE">Merge</option>
<?php if (isset($tbl_bdb)) { ?><option value="BDB">Berkeley DB</option><?php } ?>
<?php if (isset($tbl_gemini)) { ?><option value="GEMINI">Gemini</option><?php } ?>
<?php if (isset($tbl_innodb)) { ?><option value="InnoDB">INNO DB</option><?php } ?>
<?php if (isset($tbl_isam)) { ?><option value="ISAM">ISAM</option><?php } ?>
<option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
<option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
<option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
<option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
<?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
<?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
<?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
<?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
</select>
</td>
<?php