0) { $have_rel = TRUE; } else { $have_rel = FALSE; } } else { $have_rel = FALSE; } // end if /** * Displays the table structure */ $buffer = $crlf . '%' . $crlf . '% ' . $GLOBALS['strStructure'] . $crlf . '%' . $crlf . '\\begin{table} ' . $crlf . ' \\begin{longtable}{|'; if (!PMA_exportOutputHandler($buffer)) return FALSE; $columns_cnt = 4; if ($do_relation && $have_rel) { $columns_cnt++; } if ($do_comments && $cfgRelation['commwork']) { $columns_cnt++; } if ($do_mime && $cfgRelation['mimework']) { $columns_cnt++; } $buffer = ''; for($index=0;$index<$columns_cnt;$index++) { $buffer .= 'c|'; } $buffer .= '} ' . $crlf ; $buffer .= ' \\hline \\endhead \\hline \\endfoot \\hline ' . $crlf; $buffer .= $GLOBALS['strField'] . ' & ' . $GLOBALS['strType'] . ' & ' . $GLOBALS['strNull'] . ' & ' . $GLOBALS['strDefault']; if ($do_relation && $have_rel) { $buffer .= ' & ' . $GLOBALS['strLinksTo']; } if ($do_comments && $cfgRelation['commwork']) { $buffer .= ' & ' . $GLOBALS['strComments']; $comments = PMA_getComments($db, $table); } if ($do_mime && $cfgRelation['mimework']) { $buffer .= ' & MIME'; $mime_map = PMA_getMIME($db, $table, true); } $buffer .= ' \\\\ \\hline \\hline ' . $crlf; if (!PMA_exportOutputHandler($buffer)) return FALSE; while ($row = PMA_mysql_fetch_array($result)) { $type = $row['Type']; // reformat mysql query output - staybyte - 9. June 2001 // loic1: set or enum types: slashes single quotes inside options if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) { $tmp[2] = substr(ereg_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 = eregi_replace('BINARY', '', $type); $type = eregi_replace('ZEROFILL', '', $type); $type = eregi_replace('UNSIGNED', '', $type); if (empty($type)) { $type = ' '; } $binary = eregi('BINARY', $row['Type'], $test); $unsigned = eregi('UNSIGNED', $row['Type'], $test); $zerofill = eregi('ZEROFILL', $row['Type'], $test); } $strAttribute = ' '; if ($binary) { $strAttribute = 'BINARY'; } if ($unsigned) { $strAttribute = 'UNSIGNED'; } if ($zerofill) { $strAttribute = 'UNSIGNED ZEROFILL'; } if (!isset($row['Default'])) { if ($row['Null'] != '') { $row['Default'] = 'NULL'; } } else { $row['Default'] = $row['Default']; } $field_name = $row['Field']; $local_buffer = $field_name . "\000" . $type . "\000" . (($row['Null'] == '') ? $GLOBALS['strNo'] : $GLOBALS['strYes']) . "\000" . (isset($row['Default']) ? $row['Default'] : ''); if ($do_relation && $have_rel) { $local_buffer .= "\000"; if (isset($res_rel[$field_name])) { $local_buffer .= $res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']; } } if ($do_comments && $cfgRelation['commwork']) { $local_buffer .= "\000"; if (isset($comments[$field_name])) { $local_buffer .= $comments[$field_name]; } } if ($do_mime && $cfgRelation['mimework']) { $local_buffer .= "\000"; if (isset($mime_map[$field_name])) { $local_buffer .= str_replace('_', '/', $mime_map[$field_name]['mimetype']); } } for($k=0;$k