Unique fields are bold (patch #840089).

This commit is contained in:
Michal Čihař
2003-11-12 13:14:29 +00:00
parent 104257bb22
commit bc478df209
2 changed files with 15 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ $Source$
2003-11-12 Michal Cihar <nijel@users.sourceforge.net> 2003-11-12 Michal Cihar <nijel@users.sourceforge.net>
* libraries/export/latex.php3: Fixed LaTeX output (patch #840082). * libraries/export/latex.php3: Fixed LaTeX output (patch #840082).
* libraries/export/latex.php3: Unique fields are bold (patch #840089).
2003-11-11 Garvin Hicking <antikarneval@supergarv.de> 2003-11-11 Garvin Hicking <antikarneval@supergarv.de>
* libraries/display_tbl.lib.php3: Added more secure checks * libraries/display_tbl.lib.php3: Added more secure checks

View File

@@ -232,6 +232,16 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$have_rel = FALSE; $have_rel = FALSE;
} // end if } // 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 * Displays the table structure
*/ */
@@ -358,6 +368,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
$pos=strpos($local_buffer, "\000"); $pos=strpos($local_buffer, "\000");
$local_buffer = '\\textit{' . substr($local_buffer,0,$pos) . '}' . substr($local_buffer,$pos); $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 = str_replace("\000", ' & ', $local_buffer);
$buffer .= ' \\\\ \\hline ' . $crlf; $buffer .= ' \\\\ \\hline ' . $crlf;