diff --git a/ChangeLog b/ChangeLog index 5aaddc4e2..f35fa3819 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ $Source$ 2003-11-12 Michal Cihar * libraries/export/latex.php3: Fixed LaTeX output (patch #840082). + * libraries/export/latex.php3: Unique fields are bold (patch #840089). 2003-11-11 Garvin Hicking * libraries/display_tbl.lib.php3: Added more secure checks diff --git a/libraries/export/latex.php3 b/libraries/export/latex.php3 index 0a82f912d..ba1bea949 100644 --- a/libraries/export/latex.php3 +++ b/libraries/export/latex.php3 @@ -232,6 +232,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $have_rel = FALSE; } // end if + /** + * Get the unique keys in the table + */ + $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM '. PMA_backquote($db); + $keys_result = PMA_mysql_query($keys_query) or PMA_mysqlDie('', $keys_query, '', $error_url); + $unique_keys = array(); + while($key = PMA_mysql_fetch_array($keys_result)) { + if ($key['Non_unique'] == 0) $unique_keys[] = $key['Column_name']; + } + /** * Displays the table structure */ @@ -358,6 +368,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals $pos=strpos($local_buffer, "\000"); $local_buffer = '\\textit{' . substr($local_buffer,0,$pos) . '}' . substr($local_buffer,$pos); } + if (in_array($field_name, $unique_keys)) { + $pos=strpos($local_buffer, "\000"); + $local_buffer = '\\textbf{' . substr($local_buffer,0,$pos) . '}' . substr($local_buffer,$pos); + } $buffer = str_replace("\000", ' & ', $local_buffer); $buffer .= ' \\\\ \\hline ' . $crlf;