From 236eb052bc40450d6e45e3aa5d0c7933db2059a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 4 Aug 2011 16:36:23 +0200 Subject: [PATCH] Use PMA_extractFieldSpec instead of own code --- db_datadict.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/db_datadict.php b/db_datadict.php index 04a63df6a7..1c46cbb1a2 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -186,37 +186,24 @@ while ($row = PMA_DBI_fetch_row($rowset)) { if ($row['Null'] == '') { $row['Null'] = 'NO'; } - $type = $row['Type']; + $extracted_fieldspec = PMA_extractFieldSpec($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]) . ')'; + if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) { $type_nowrap = ''; - $binary = 0; - $unsigned = 0; - $zerofill = 0; } else { - $binary = stristr($row['Type'], 'binary'); - $unsigned = stristr($row['Type'], 'unsigned'); - $zerofill = stristr($row['Type'], 'zerofill'); $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 = ' '; - } } + $type = htmlspecialchars($extracted_fieldspec['print_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($row['Default'])) {