diff options
author | Piotr Przybylski <piotrprz@gmail.com> | 2011-08-04 22:19:43 +0400 |
---|---|---|
committer | Piotr Przybylski <piotrprz@gmail.com> | 2011-08-04 22:19:43 +0400 |
commit | 66665f326ae28740ea10939feebe223b702943b8 (patch) | |
tree | 5afaa242e8d25148b9ab5c3648a0754b6de46d53 /db_datadict.php | |
parent | 3fa5e89bb29bb481576a2cf81d3364402bef8dcf (diff) | |
parent | 4c62a5fed6efe79b9ab9c667458d365058a914dc (diff) |
Merge remote-tracking branch 'origin/master' into drizzle
Conflicts:
db_qbe.php
js/server_status.js
libraries/export/xml.php
libraries/schema/Pdf_Relation_Schema.class.php
tbl_printview.php
tbl_structure.php
Diffstat (limited to 'db_datadict.php')
-rw-r--r-- | db_datadict.php | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/db_datadict.php b/db_datadict.php index 533b5a0d4f..ca39888eff 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -119,8 +119,8 @@ while ($row = PMA_DBI_fetch_row($rowset)) { /** * Gets columns properties */ - $result = PMA_DBI_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE); - $fields_cnt = PMA_DBI_num_rows($result); + $columns = PMA_DBI_get_columns($db, $table); + $fields_cnt = count($columns); if (PMA_MYSQL_INT_VERSION < 50025) { // We need this to correctly learn if a TIMESTAMP is NOT NULL, since @@ -181,44 +181,22 @@ while ($row = PMA_DBI_fetch_row($rowset)) { </tr> <?php $odd_row = true; - while ($row = PMA_DBI_fetch_assoc($result)) { + foreach ($columns as $row) { 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 = ' '; - } - } - $attribute = ' '; - if ($binary) { - $attribute = 'BINARY'; - } - if ($unsigned) { - $attribute = 'UNSIGNED'; - } - if ($zerofill) { - $attribute = 'UNSIGNED ZEROFILL'; } + $type = htmlspecialchars($extracted_fieldspec['print_type']); + $attribute = $extracted_fieldspec['attribute']; if (! isset($row['Default'])) { if ($row['Null'] != 'NO') { $row['Default'] = '<i>NULL</i>'; @@ -284,8 +262,7 @@ while ($row = PMA_DBI_fetch_row($rowset)) { ?> </tr> <?php - } // end while - PMA_DBI_free_result($result); + } // end foreach $count++; ?> </table> |