support ROW_FORMAT and PAGE_CHECKSUM table option; verify warnings coming from ALTER TABLE

This commit is contained in:
Marc Delisle
2008-03-21 13:38:23 +00:00
parent d7e690e069
commit 32bb3ab273
5 changed files with 69 additions and 4 deletions

View File

@@ -47,7 +47,8 @@ danbarry
* minimal support on db structure page
* export
+ [pdf] Merged tcpdf 2.2.002 (PHP5 version), thanks to Nicola Asuni
+ [engines] Maria (work in progress)
+ [engines] Maria support
+ [engines] MyISAM and InnoDB: support ROW_FORMAT table option
2.11.6.0 (not yet released)
- bug #1903724 [interface] Displaying of very large queries in error message

View File

@@ -2328,6 +2328,29 @@ function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '
}
}
/**
* Generates and echoes an HTML dropdown
*
* @uses htmlspecialchars()
* @param string $select_name
* @param array $choices the choices values
* @param string $active_choice the choice to select by default
* @todo support titles
*/
function PMA_generate_html_dropdown($select_name, $choices, $active_choice)
{
$result = '<select name="' . htmlspecialchars($select_name) . '" id="' . htmlspecialchars($select_name) . '">"' . "\n";
foreach ($choices as $one_choice) {
$result .= '<option value="' . htmlspecialchars($one_choice) . '"';
if ($one_choice == $active_choice) {
$result .= ' selected="selected"';
}
$result .= '>' . htmlspecialchars($one_choice) . '</option>' . "\n";
}
$result .= '</select>' . "\n";
echo $result;
}
/**
* Generates a slider effect (Mootools)
*

View File

@@ -572,6 +572,7 @@ $PMA_SQPdata_reserved_word = array (
'OUTER',
'OUTFILE',
'PACK_KEYS',
'PAGE', // 5.1-maria ?
'PARTIAL',
'PARTITION', // 5.1
'PARTITIONS', // 5.1
@@ -685,7 +686,7 @@ $PMA_SQPdata_reserved_word = array (
*
* @global integer MySQL reserved words count
*/
$PMA_SQPdata_reserved_word_cnt = 283;
$PMA_SQPdata_reserved_word_cnt = 284;
/**
* The previous array must be sorted so that the binary search work.
* Sometimes a word is not added in the correct order, so

View File

@@ -80,6 +80,7 @@ if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
$showtable['Name'], true, true);
}
$table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
$row_format = isset($showtable['Row_format']) ? $showtable['Row_format'] : '';
$auto_increment = isset($showtable['Auto_increment'])
? $showtable['Auto_increment']
: '';

View File

@@ -59,6 +59,7 @@ if ($is_maria) {
// ($transactional may have been set by libraries/tbl_info.inc.php,
// from the $create_options)
$transactional = (isset($transactional) && $transactional == '0') ? '0' : '1';
$page_checksum = (isset($page_checksum)) ? $page_checksum : '';
}
$reread_info = false;
@@ -69,6 +70,8 @@ $table_alters = array();
*/
if (isset($_REQUEST['submitoptions'])) {
$_message = '';
$warning_messages = array();
if (isset($_REQUEST['new_name'])) {
if ($pma_table->rename($_REQUEST['new_name'])) {
$_message .= $pma_table->getLastMessage();
@@ -136,12 +139,22 @@ if (isset($_REQUEST['submitoptions'])) {
$table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
}
if (($is_myisam_or_maria || $is_innodb)
&& ! empty($_REQUEST['new_row_format'])
&& (! isset($row_format) || $_REQUEST['new_row_format'] !== $row_format)) {
$table_alters[] = 'ROW_FORMAT = ' . PMA_sqlAddslashes($_REQUEST['new_row_format']);
}
if (count($table_alters) > 0) {
$sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
$sql_query .= "\r\n" . implode("\r\n", $table_alters);
$result .= PMA_DBI_query($sql_query) ? true : false;
$reread_info = true;
unset($table_alters);
foreach (PMA_DBI_get_warnings() as $warning) {
$warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
. ' ' . $warning['Message'];
}
}
}
/**
@@ -179,10 +192,17 @@ require_once './libraries/tbl_links.inc.php';
if (isset($result)) {
if (empty($_message)) {
$_message = $result ? $strSuccess : $strError;
// $result should exist, regardless of $_message
$_type = $result ? 'success' : 'error';
}
if (! empty($warning_messages)) {
$_message = new PMA_Message;
$_message->addMessages($warning_messages);
$_message->isWarning(true);
unset($warning_messages);
}
// $result should exist, regardless of $_message
$_type = $result ? 'success' : 'error';
PMA_showMessage($_message, $sql_query, $_type);
unset($_message, $_type);
}
$url_params['goto'] = 'tbl_operations.php';
@@ -400,6 +420,25 @@ if (isset($auto_increment) && strlen($auto_increment) > 0
</tr>
<?php
} // end if (MYISAM|INNODB)
$possible_row_formats = array(
'MARIA' => array('FIXED','DYNAMIC','PAGE'),
'MYISAM' => array('FIXED','DYNAMIC'),
'INNODB' => array('COMPACT','REDUNDANT')
);
// for MYISAM there is also COMPRESSED but it can be set only by the
// myisampack utility, so don't offer here the choice because if we
// try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
// does not return a warning
// (if the table was compressed, it can be seen on the Structure page)
$current_row_format = strtoupper($showtable['Row_format']);
echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
echo '<td>';
PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format);
unset($possible_row_formats, $current_row_format);
echo '</td>';
echo '</tr>';
?>
</table>
</fieldset>