From 74ec215abc6ce6dead7a9f23f870e1eec4b436e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 14 Feb 2005 17:00:08 +0000 Subject: - Fix displaying indexes for print view, use same function as for normal view (bug #1119388). - Use CSS for hiding print button rather than javascript. --- tbl_printview.php | 91 ++++--------------------------------------------------- 1 file changed, 6 insertions(+), 85 deletions(-) (limited to 'tbl_printview.php') diff --git a/tbl_printview.php b/tbl_printview.php index 647481a8d5..cc950aad80 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -21,6 +21,7 @@ if (!isset($the_tables) || !is_array($the_tables)) { */ require_once('./libraries/relation.lib.php'); require_once('./libraries/transformations.lib.php'); +require_once('./libraries/tbl_indexes.lib.php'); $cfgRelation = PMA_getRelationsParam(); @@ -86,47 +87,13 @@ foreach ($the_tables AS $key => $table) { PMA_DBI_free_result($result); - /** - * Gets table keys and retains them - */ - $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); - $primary = ''; + // Gets table keys and store them in arrays $indexes = array(); - $lastIndex = ''; $indexes_info = array(); $indexes_data = array(); - $pk_array = array(); // will be use to emphasis prim. keys in the table - // view - while ($row = PMA_DBI_fetch_assoc($result)) { - // Backups the list of primary keys - if ($row['Key_name'] == 'PRIMARY') { - $primary .= $row['Column_name'] . ', '; - $pk_array[$row['Column_name']] = 1; - } - // Retains keys informations - if ($row['Key_name'] != $lastIndex ){ - $indexes[] = $row['Key_name']; - $lastIndex = $row['Key_name']; - } - $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; - $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; - if (isset($row['Cardinality'])) { - $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; - } -// I don't know what does following column mean.... -// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; - $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; - - $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; - if (isset($row['Sub_part'])) { - $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; - } - - } // end while - if ($result) { - PMA_DBI_free_result($result); - } + $ret_keys = PMA_get_indexes($table, $err_url_0); + PMA_extract_indexes($ret_keys, $indexes, $indexes_info, $indexes_data); /** * Gets fields properties @@ -311,51 +278,7 @@ foreach ($the_tables AS $key => $table) { $index_name) { - $cell_bgd = (($index_no % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']); - $index_td = ' ' . "\n"; - echo ' ' . "\n"; - echo $index_td - . ' ' . htmlspecialchars($index_name) . "\n" - . ' ' . "\n"; - - if ($indexes_info[$index_name]['Comment'] == 'FULLTEXT') { - $index_type = 'FULLTEXT'; - } else if ($index_name == 'PRIMARY') { - $index_type = 'PRIMARY'; - } else if ($indexes_info[$index_name]['Non_unique'] == '0') { - $index_type = 'UNIQUE'; - } else { - $index_type = 'INDEX'; - } - echo $index_td - . ' ' . $index_type . "\n" - . ' ' . "\n"; - - echo $index_td - . ' ' . (isset($indexes_info[$index_name]['Cardinality']) ? $indexes_info[$index_name]['Cardinality'] : $strNone) . "\n" - . ' ' . "\n"; - - foreach ($indexes_info[$index_name]['Sequences'] AS $row_no => $seq_index) { - if ($row_no > 0) { - echo ' ' . "\n"; - } - if (!empty($indexes_data[$index_name][$seq_index]['Sub_part'])) { - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Sub_part'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n"; - } else { - echo ' ' . "\n" - . ' ' . $indexes_data[$index_name][$seq_index]['Column_name'] . "\n" - . ' ' . "\n"; - echo ' ' . "\n"; - } - } // end while - } // end while + PMA_show_indexes($table, $indexes, $indexes_info, $indexes_data, true, true); echo "\n"; ?> @@ -615,17 +538,15 @@ echo "\n";
 ' . "\n"; +echo '

 ' . "\n"; require_once('./footer.inc.php'); ?> -- cgit v1.2.3