diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index 707bc7714c..5c7a84e751 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -273,40 +273,10 @@ if (isset($plugin_list)) { foreach ($columns as $column) { $schema_insert = ''; - $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'; diff --git a/libraries/export/latex.php b/libraries/export/latex.php index cbf51418d3..54ee50453b 100644 --- a/libraries/export/latex.php +++ b/libraries/export/latex.php @@ -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'; diff --git a/libraries/export/odt.php b/libraries/export/odt.php index e02f8a6ea1..16867a69a9 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -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'] .= ''; - $GLOBALS['odt_buffer'] .= '' - . '' . htmlspecialchars($field_name) . '' - . ''; - // 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'] .= '' . '' . htmlspecialchars($type) . '' . '';