Use PMA_extractFieldSpec instead of own code

This commit is contained in:
Michal Čihař 2011-08-04 17:04:12 +02:00
parent 87c970b0f8
commit f646fc8a55

View File

@ -252,38 +252,21 @@ if (isset($plugin_list)) {
foreach ($columns as $column) {
$text_output = '';
$type = $column['Type'];
// reformat mysql query output
// set or enum types: slashes single quotes inside options
if (preg_match('/^(set|enum)\((.+)\)$/i', $type, $tmp)) {
$tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
$binary = 0;
$unsigned = 0;
$zerofill = 0;
} else {
$type_nowrap = ' nowrap="nowrap"';
$type = preg_replace('/BINARY/i', '', $type);
$type = preg_replace('/ZEROFILL/i', '', $type);
$type = preg_replace('/UNSIGNED/i', '', $type);
if (empty($type)) {
$type = ' ';
}
$binary = preg_match('/BINARY/i', $column['Type']);
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
$extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
$type = $extracted_fieldspec['print_type'];
if (empty($type)) {
$type = ' ';
}
$attribute = ' ';
if ($binary) {
if ($extracted_fieldspec['binary']) {
$attribute = 'BINARY';
}
if ($unsigned) {
if ($extracted_fieldspec['unsigned']) {
$attribute = 'UNSIGNED';
}
if ($zerofill) {
if ($extracted_fieldspec['zerofill']) {
$attribute = 'UNSIGNED ZEROFILL';
}
if (! isset($column['Default'])) {