@@ -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 (isset($submitcomment)) {
|
||||||
if (MYSQL_INT_VERSION >= 32303) {
|
if (get_magic_quotes_gpc()) {
|
||||||
// Update table type, comment and order if required by the user
|
$comment = stripslashes($comment);
|
||||||
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($submittype)) {
|
if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
|
||||||
$local_query = 'ALTER TABLE ' . backquote($table) . ' TYPE = ' . $tbl_type;
|
$local_query = 'ALTER TABLE ' . backquote($table) . ' COMMENT = \'' . sql_addslashes($comment) . '\'';
|
||||||
$result = mysql_query($local_query) or mysql_die('', $local_query);
|
$result = mysql_query($local_query) or mysql_die('', $local_query);
|
||||||
}
|
}
|
||||||
if (isset($submitorderby) && !empty($order_field)) {
|
}
|
||||||
$order_field = backquote(urldecode($order_field));
|
if (isset($submittype)) {
|
||||||
$local_query = 'ALTER TABLE ' . backquote($table) . 'ORDER BY ' . $order_field;
|
$local_query = 'ALTER TABLE ' . backquote($table) . ' TYPE = ' . $tbl_type;
|
||||||
$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) . '\'';
|
|
||||||
$result = mysql_query($local_query) or mysql_die('', $local_query);
|
$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 = '';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($num_rows > 0) {
|
||||||
|
echo "\n";
|
||||||
|
?>
|
||||||
<!-- first browse links -->
|
<!-- first browse links -->
|
||||||
<p>
|
<p>
|
||||||
[ <a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
|
[ <a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('SELECT * FROM ' . backquote($table)); ?>&pos=0">
|
||||||
@@ -125,10 +139,10 @@ if (MYSQL_INT_VERSION >= 32303) {
|
|||||||
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
|
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
|
||||||
<b><?php echo $strDrop; ?></b></a> ]
|
<b><?php echo $strDrop; ?></b></a> ]
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<!-- first browse links -->
|
<!-- first browse links -->
|
||||||
<p>
|
<p>
|
||||||
[ <b><?php echo $strBrowse; ?></b> ]
|
[ <b><?php echo $strBrowse; ?></b> ]
|
||||||
@@ -140,27 +154,18 @@ if (MYSQL_INT_VERSION >= 32303) {
|
|||||||
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
|
onclick="return confirmLink(this, 'DROP TABLE <?php echo js_format($table); ?>')">
|
||||||
<b><?php echo $strDrop; ?></b></a> ]
|
<b><?php echo $strDrop; ?></b></a> ]
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
if (!empty($showtable['Comment'])) {
|
|
||||||
$show_comment = $showtable['Comment'];
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
if (!empty($show_comment)) {
|
||||||
|
?>
|
||||||
<!-- Table comment -->
|
<!-- Table comment -->
|
||||||
<p><i>
|
<p><i>
|
||||||
<?php echo $show_comment . "\n"; ?>
|
<?php echo $show_comment . "\n"; ?>
|
||||||
</i></p>
|
</i></p>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} // end (1.)
|
||||||
$show_comment = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// MySQL < 3.23.03
|
|
||||||
else {
|
|
||||||
$showtable = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Get table keys and retains them
|
// 2. Get table keys and retains them
|
||||||
$local_query = 'SHOW KEYS FROM ' . backquote($table);
|
$local_query = 'SHOW KEYS FROM ' . backquote($table);
|
||||||
@@ -177,7 +182,8 @@ while($row = mysql_fetch_array($result)) {
|
|||||||
|
|
||||||
// 3. Get fields
|
// 3. Get fields
|
||||||
$local_query = 'SHOW FIELDS FROM ' . backquote($table);
|
$local_query = 'SHOW FIELDS FROM ' . backquote($table);
|
||||||
$result = mysql_query($local_query) or mysql_die('', $local_query);
|
$result = mysql_query($local_query) or mysql_die('', $local_query);
|
||||||
|
$fields_cnt = mysql_num_rows($result);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +197,7 @@ $result = mysql_query($local_query) or mysql_die('', $local_query);
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if (mysql_num_rows($result) > 1) {
|
if ($fields_cnt > 1) {
|
||||||
?>
|
?>
|
||||||
<form action="tbl_properties.php3">
|
<form action="tbl_properties.php3">
|
||||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||||
@@ -207,7 +213,7 @@ echo "\n";
|
|||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if (mysql_num_rows($result) > 1) {
|
if ($fields_cnt > 1) {
|
||||||
echo ' <td></td>' . "\n";
|
echo ' <td></td>' . "\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -276,7 +282,7 @@ while ($row = mysql_fetch_array($result)) {
|
|||||||
<tr bgcolor="<?php echo $bgcolor; ?>">
|
<tr bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<?php
|
<?php
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if (mysql_num_rows($result) > 1) {
|
if ($fields_cnt > 1) {
|
||||||
?>
|
?>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<input type="checkbox" name="selected_fld[]" value="<?php echo urlencode($row['Field']); ?>" />
|
<input type="checkbox" name="selected_fld[]" value="<?php echo urlencode($row['Field']); ?>" />
|
||||||
@@ -298,7 +304,7 @@ while ($row = mysql_fetch_array($result)) {
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
// loic1: Drop field only if there is more than one field in the table
|
// loic1: Drop field only if there is more than one field in the table
|
||||||
if (mysql_num_rows($result) > 1) {
|
if ($fields_cnt > 1) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP ' . backquote($row['Field'])); ?>&zero_rows=<?php echo urlencode(htmlspecialchars($row['Field']) . ' ' . $strHasBeenDropped); ?>"
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . backquote($table) . ' DROP ' . backquote($row['Field'])); ?>&zero_rows=<?php echo urlencode(htmlspecialchars($row['Field']) . ' ' . $strHasBeenDropped); ?>"
|
||||||
@@ -330,7 +336,7 @@ while ($row = mysql_fetch_array($result)) {
|
|||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if (mysql_num_rows($result) > 1) {
|
if ($fields_cnt > 1) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="12">
|
<td colspan="12">
|
||||||
@@ -376,14 +382,14 @@ if ($index_count > 0) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $strKeyname; ?></th>
|
<th><?php echo $strKeyname; ?></th>
|
||||||
<th><?php echo $strUnique; ?></th>
|
<th><?php echo $strUnique; ?></th>
|
||||||
<th><?php echo $strField; ?></th>
|
<th colspan="2"><?php echo $strField; ?></th>
|
||||||
<th><?php echo $strAction; ?></th>
|
<th><?php echo $strAction; ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
for ($i = 0; $i < $index_count; $i++) {
|
for ($i = 0; $i < $index_count; $i++) {
|
||||||
$row = $ret_keys[$i];
|
$row = $ret_keys[$i];
|
||||||
if (isset($row['Seq_in_index'])) {
|
if (isset($row['Seq_in_index'])) {
|
||||||
$key_name = htmlspecialchars($row['Key_name']) . ' <small>-' . $row['Seq_in_index'] . '-</small>';
|
$key_name = htmlspecialchars($row['Key_name']) . '<nobr> <small>-' . $row['Seq_in_index'] . '-</small></nobr>';
|
||||||
} else {
|
} else {
|
||||||
$key_name = htmlspecialchars($row['Key_name']);
|
$key_name = htmlspecialchars($row['Key_name']);
|
||||||
}
|
}
|
||||||
@@ -433,23 +439,25 @@ $nonisam = FALSE;
|
|||||||
if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) {
|
if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) {
|
||||||
$nonisam = TRUE;
|
$nonisam = TRUE;
|
||||||
}
|
}
|
||||||
if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE && isset($showtable)) {
|
if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE) {
|
||||||
// Gets some sizes
|
// Gets some sizes
|
||||||
$mergetable = FALSE;
|
$mergetable = FALSE;
|
||||||
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
|
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
|
||||||
$mergetable = TRUE;
|
$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) {
|
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) {
|
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']);
|
||||||
list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
|
if ($num_rows > 0) {
|
||||||
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($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Displays them
|
// Displays them
|
||||||
@@ -514,7 +522,7 @@ if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE && isset($showtable)) {
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" align="center">
|
<td colspan="3" align="center">
|
||||||
[<a href="sql.php3?<?php echo $url_query; ?>&pos=0&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple"><?php echo $strOptimizeTable; ?></a>]
|
[<a href="sql.php3?<?php echo $url_query; ?>&pos=0&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
|
||||||
</td>
|
</td>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
@@ -942,7 +950,7 @@ if (MYSQL_INT_VERSION >= 32322) {
|
|||||||
if ($tbl_type == 'MYISAM') {
|
if ($tbl_type == 'MYISAM') {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('CHECK TABLE ' . backquote($table)); ?>&display=simple">
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('CHECK TABLE ' . backquote($table)); ?>">
|
||||||
<?php echo $strCheckTable; ?></a>
|
<?php echo $strCheckTable; ?></a>
|
||||||
<?php echo show_docu('manual_Reference.html#CHECK_TABLE') . "\n"; ?>
|
<?php echo show_docu('manual_Reference.html#CHECK_TABLE') . "\n"; ?>
|
||||||
</td>
|
</td>
|
||||||
@@ -953,7 +961,7 @@ if (MYSQL_INT_VERSION >= 32322) {
|
|||||||
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ANALYZE TABLE ' . backquote($table)); ?>&display=simple">
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ANALYZE TABLE ' . backquote($table)); ?>">
|
||||||
<?php echo $strAnalyzeTable; ?></a>
|
<?php echo $strAnalyzeTable; ?></a>
|
||||||
<?php echo show_docu('manual_Reference.html#ANALYZE_TABLE') . "\n";?>
|
<?php echo show_docu('manual_Reference.html#ANALYZE_TABLE') . "\n";?>
|
||||||
</td>
|
</td>
|
||||||
@@ -969,7 +977,7 @@ if (MYSQL_INT_VERSION >= 32322) {
|
|||||||
if ($tbl_type == 'MYISAM') {
|
if ($tbl_type == 'MYISAM') {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('REPAIR TABLE ' . backquote($table)); ?>&display=simple">
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('REPAIR TABLE ' . backquote($table)); ?>">
|
||||||
<?php echo $strRepairTable; ?></a>
|
<?php echo $strRepairTable; ?></a>
|
||||||
<?php echo show_docu('manual_Reference.html#REPAIR_TABLE') . "\n"; ?>
|
<?php echo show_docu('manual_Reference.html#REPAIR_TABLE') . "\n"; ?>
|
||||||
</td>
|
</td>
|
||||||
@@ -980,7 +988,7 @@ if (MYSQL_INT_VERSION >= 32322) {
|
|||||||
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
if ($tbl_type == 'MYISAM' || $tbl_type == 'BDB') {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple">
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>">
|
||||||
<?php echo $strOptimizeTable; ?></a>
|
<?php echo $strOptimizeTable; ?></a>
|
||||||
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
||||||
</td>
|
</td>
|
||||||
@@ -1078,7 +1086,7 @@ else { // MySQL < 3.23
|
|||||||
<li style="vertical-align: top">
|
<li style="vertical-align: top">
|
||||||
<div style="margin-bottom: 10px">
|
<div style="margin-bottom: 10px">
|
||||||
<?php echo $strTableMaintenance; ?> :
|
<?php echo $strTableMaintenance; ?> :
|
||||||
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>&display=simple">
|
<a href="sql.php3?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . backquote($table)); ?>">
|
||||||
<?php echo $strOptimizeTable; ?></a>
|
<?php echo $strOptimizeTable; ?></a>
|
||||||
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
<?php echo show_docu('manual_Reference.html#OPTIMIZE_TABLE') . "\n"; ?>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user