diff --git a/tbl_properties.php3 b/tbl_properties.php3 index a228ecb7c9..375a8bd704 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -77,39 +77,53 @@ $url_query = 'lang=' . $lang /** - * Gets table informations + * Updates table type, comment and order if required */ -// 1. Get table type and comments ('show table' works correct since 3.23.03) -if (MYSQL_INT_VERSION >= 32303) { - // Update table type, comment and order if required by the user - if (isset($submitcomment)) { - if (get_magic_quotes_gpc()) { - $comment = stripslashes($comment); - } - if (empty($prev_comment) || urldecode($prev_comment) != str_replace('"', '"', $comment)) { - $local_query = 'ALTER TABLE ' . backquote($table) . ' COMMENT = \'' . sql_addslashes($comment) . '\''; - $result = mysql_query($local_query) or mysql_die('', $local_query); - } +if (isset($submitcomment)) { + if (get_magic_quotes_gpc()) { + $comment = stripslashes($comment); } - if (isset($submittype)) { - $local_query = 'ALTER TABLE ' . backquote($table) . ' TYPE = ' . $tbl_type; + if (empty($prev_comment) || urldecode($prev_comment) != $comment) { + $local_query = 'ALTER TABLE ' . backquote($table) . ' COMMENT = \'' . sql_addslashes($comment) . '\''; $result = mysql_query($local_query) or mysql_die('', $local_query); } - if (isset($submitorderby) && !empty($order_field)) { - $order_field = backquote(urldecode($order_field)); - $local_query = 'ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field; - $result = mysql_query($local_query) or mysql_die('', $local_query); - } - - // Get table type and comments and displays first browse links - $local_query = 'SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\''; +} +if (isset($submittype)) { + $local_query = 'ALTER TABLE ' . backquote($table) . ' TYPE = ' . $tbl_type; $result = mysql_query($local_query) or mysql_die('', $local_query); - $showtable = mysql_fetch_array($result); - $tbl_type = strtoupper($showtable['Type']); +} +if (isset($submitorderby) && !empty($order_field)) { + $order_field = backquote(urldecode($order_field)); + $local_query = 'ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field; + $result = mysql_query($local_query) or mysql_die('', $local_query); +} - if (isset($showtable['Rows']) && $showtable['Rows'] > 0) { - echo "\n"; - ?> + +/** + * Gets table informations and displays these informations and also top + * browse/select/insert/empty links + */ +// The 'show table' statement works correct since 3.23.03 +if (MYSQL_INT_VERSION >= 32303) { + $local_query = 'SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\''; + $result = mysql_query($local_query) or mysql_die('', $local_query); + $showtable = mysql_fetch_array($result); + $tbl_type = strtoupper($showtable['Type']); + $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); + $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); +} else { + $local_query = 'SELECT COUNT(*) AS count FROM ' . backquote($table); + $result = mysql_query($local_query) or mysql_die('', $local_query); + $showtable = array(); + $num_rows = mysql_result($result, 0, 'count'); + $show_comment = ''; +} +?> + + 0) { + echo "\n"; + ?>

[ @@ -125,10 +139,10 @@ if (MYSQL_INT_VERSION >= 32303) { onclick="return confirmLink(this, 'DROP TABLE ')"> ]

- +

[ ]    @@ -140,27 +154,18 @@ if (MYSQL_INT_VERSION >= 32303) { onclick="return confirmLink(this, 'DROP TABLE ')"> ]

- +

- 1) { +if ($fields_cnt > 1) { ?>
@@ -207,7 +213,7 @@ echo "\n"; 1) { +if ($fields_cnt > 1) { echo ' ' . "\n"; } ?> @@ -276,7 +282,7 @@ while ($row = mysql_fetch_array($result)) { 1) { + if ($fields_cnt > 1) { ?> @@ -298,7 +304,7 @@ while ($row = mysql_fetch_array($result)) { 1) { + if ($fields_cnt > 1) { echo "\n"; ?> 1) { +if ($fields_cnt > 1) { ?> @@ -376,14 +382,14 @@ if ($index_count > 0) { - + -' . $row['Seq_in_index'] . '-'; + $key_name = htmlspecialchars($row['Key_name']) . ' -' . $row['Seq_in_index'] . '-'; } else { $key_name = htmlspecialchars($row['Key_name']); } @@ -433,23 +439,25 @@ $nonisam = FALSE; if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) { $nonisam = TRUE; } -if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE && isset($showtable)) { +if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) { // Gets some sizes $mergetable = FALSE; if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') { $mergetable = TRUE; } - list($data_size, $data_unit) = format_byte_down($showtable['Data_length']); + list($data_size, $data_unit) = format_byte_down($showtable['Data_length']); if ($mergetable == FALSE) { - list($index_size, $index_unit) = format_byte_down($showtable['Index_length']); + list($index_size, $index_unit) = format_byte_down($showtable['Index_length']); } if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) { - list($free_size, $free_unit) = format_byte_down($showtable['Data_free']); + list($free_size, $free_unit) = format_byte_down($showtable['Data_free']); + list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']); + } else { + list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']); } - list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']); - list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']); - if (isset($showtable['Rows']) && $showtable['Rows']>0) { - list($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1); + list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']); + if ($num_rows > 0) { + list($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1); } // Displays them @@ -514,7 +522,7 @@ if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE && isset($showtable)) { ?> - [] + [] = 32322) { if ($tbl_type == 'MYISAM') { ?> - +   @@ -953,7 +961,7 @@ if (MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') { ?> - +   @@ -969,7 +977,7 @@ if (MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM') { ?> - +   @@ -980,7 +988,7 @@ if (MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') { ?> - +   @@ -1078,7 +1086,7 @@ else { // MySQL < 3.23
  •  :  - +