Use PMA_extractFieldSpec instead of own code in export plugins
This commit is contained in:
parent
236eb052bc
commit
d29cf3227d
@ -273,40 +273,10 @@ if (isset($plugin_list)) {
|
||||
foreach ($columns as $column) {
|
||||
|
||||
$schema_insert = '<tr class="print-category">';
|
||||
$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 = ' ';
|
||||
}
|
||||
$extracted_fieldspec = PMA_extractFieldSpec($column['Type']);
|
||||
$type = $extracted_fieldspec['print_type'];
|
||||
|
||||
$binary = preg_match('/BINARY/i', $column['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $column['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $column['Type']);
|
||||
}
|
||||
$attribute = ' ';
|
||||
if ($binary) {
|
||||
$attribute = 'BINARY';
|
||||
}
|
||||
if ($unsigned) {
|
||||
$attribute = 'UNSIGNED';
|
||||
}
|
||||
if ($zerofill) {
|
||||
$attribute = 'UNSIGNED ZEROFILL';
|
||||
}
|
||||
if (! isset($column['Default'])) {
|
||||
if ($column['Null'] != 'NO') {
|
||||
$column['Default'] = 'NULL';
|
||||
|
||||
@ -391,30 +391,8 @@ if (isset($plugin_list)) {
|
||||
|
||||
$fields = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($fields as $row) {
|
||||
$type = $row['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', $row['Type']);
|
||||
$unsigned = preg_match('/UNSIGNED/i', $row['Type']);
|
||||
$zerofill = preg_match('/ZEROFILL/i', $row['Type']);
|
||||
}
|
||||
$extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
|
||||
$type = $extracted_fieldspec['print_type'];
|
||||
if (!isset($row['Default'])) {
|
||||
if ($row['Null'] != 'NO') {
|
||||
$row['Default'] = 'NULL';
|
||||
|
||||
@ -317,36 +317,9 @@ if (isset($plugin_list)) {
|
||||
|
||||
$columns = PMA_DBI_get_columns($db, $table);
|
||||
foreach ($columns as $column) {
|
||||
$extracted_fieldspec = PMA_extractFieldSpec($column['Type']);
|
||||
$type = $extracted_fieldspec['print_type'];
|
||||
|
||||
$field_name = $column['Field'];
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-row>';
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
// reformat mysql query output
|
||||
// set or enum types: slashes single quotes inside options
|
||||
$type = $column['Type'];
|
||||
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']);
|
||||
}
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . htmlspecialchars($type) . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user