3 // vim: expandtab sw=4 ts=4 sts=4:
5 require_once('./libraries/common.lib.php');
8 * Gets the variables sent or posted to this script, then displays headers
11 require_once('./header.inc.php');
14 PMA_checkParameters(array('db'));
17 * Defines the url to return to in case of error in a sql statement
19 $err_url = 'db_details.php?' . PMA_generate_common_url($db);
22 * Settings for relations stuff
24 require_once('./libraries/relation.lib.php');
25 $cfgRelation = PMA_getRelationsParam();
28 * Gets the list of the table in the current db and informations about these
31 // staybyte: speedup view on locked tables - 11 June 2001
32 // Special speedup for newer MySQL Versions (in 4.0 format changed)
33 if ($cfg['SkipLockedTables'] == TRUE) {
34 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
35 // Blending out tables in use
36 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
37 while ($tmp = PMA_DBI_fetch_row($result)) {
38 // if in use memorize tablename
39 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
40 $sot_cache[$tmp[0]] = TRUE;
43 PMA_DBI_free_result($result);
46 if (isset($sot_cache)) {
47 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE
);
48 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
49 while ($tmp = PMA_DBI_fetch_row($result)) {
50 if (!isset($sot_cache[$tmp[0]])) {
51 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
52 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
54 } else { // table in use
55 $tables[] = array('Name' => $tmp[0]);
58 PMA_DBI_free_result($result);
65 if (!isset($sot_ready)) {
66 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
67 if (PMA_DBI_num_rows($result) > 0) {
68 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
71 PMA_DBI_free_result($result);
75 $num_tables = (isset($tables) ?
count($tables) : 0);
77 if ($cfgRelation['commwork']) {
78 $comment = PMA_getComments($db);
83 if (is_array($comment)) {
87 <?php
echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?
>
94 * If there is at least one table, displays the printer friendly view, else
98 if ($num_tables == 0) {
99 echo $strNoTablesFound;
101 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
105 <!-- The tables
list -->
106 <table border
="<?php echo $cfg['Border']; ?>">
108 <th
> 
;<?php
echo $strTable; ?
> 
;</th
>
109 <th
><?php
echo $strRecords; ?
></th
>
110 <th
><?php
echo $strType; ?
></th
>
112 if ($cfg['ShowStats']) {
113 echo '<th>' . $strSize . '</th>';
117 <th
><?php
echo $strComments; ?
></th
>
120 $i = $sum_entries = $sum_size = 0;
121 foreach ($tables AS $keyname => $sts_data) {
122 $table = $sts_data['Name'];
123 $bgcolor = ($i++ %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
127 <td bgcolor
="<?php echo $bgcolor; ?>" nowrap
="nowrap">
128  
;<b
><?php
echo htmlspecialchars($table); ?
> 
;</b
> 
;
134 if (isset($sts_data['Type'])) {
135 if ($sts_data['Type'] == 'MRG_MyISAM') {
137 } else if (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
142 if (isset($sts_data['Rows'])) {
143 if ($mergetable == FALSE) {
144 if ($cfg['ShowStats'] && $nonisam == FALSE) {
145 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
146 $sum_size +
= $tblsize;
148 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
150 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
152 } else if ($cfg['ShowStats']) {
153 $formated_size = ' - ';
156 $sum_entries +
= $sts_data['Rows'];
158 // MyISAM MERGE Table
159 else if ($cfg['ShowStats'] && $mergetable == TRUE) {
160 $formated_size = ' - ';
163 else if ($cfg['ShowStats']) {
164 $formated_size = 'unknown';
168 <td align
="right" bgcolor
="<?php echo $bgcolor; ?>">
171 if ($mergetable == TRUE) {
172 echo '<i>' . number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
174 echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
178 <td nowrap
="nowrap" bgcolor
="<?php echo $bgcolor; ?>">
179  
;<?php
echo (isset($sts_data['Type']) ?
$sts_data['Type'] : ' '); ?
> 
;
182 if ($cfg['ShowStats']) {
185 <td align
="right" bgcolor
="<?php echo $bgcolor; ?>" nowrap
="nowrap">
186  
;<?php
echo $formated_size . ' ' . $unit . "\n"; ?
>
193 <td colspan
="3" align
="center" bgcolor
="<?php echo $bgcolor; ?>">
194 <?php
echo $strInUse . "\n"; ?
>
200 <td bgcolor
="<?php echo $bgcolor; ?>">
201 <?php
echo $sts_data['Comment']; ?
>
203 if (!empty($sts_data['Comment'])) {
204 $needs_break = '<br />';
209 if ((isset($sts_data['Create_time']) && !empty($sts_data['Create_time']))
210 ||
(isset($sts_data['Update_time']) && !empty($sts_data['Update_time']))
211 ||
(isset($sts_data['Check_time']) && !empty($sts_data['Check_time']))) {
214 <table border
="0" cellpadding
="1" cellspacing
="1" width
="100%" class="noborder">
217 if (isset($sts_data['Create_time']) && !empty($sts_data['Create_time'])) {
220 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatCreateTime . ': '; ?
></td
>
221 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
226 if (isset($sts_data['Update_time']) && !empty($sts_data['Update_time'])) {
229 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatUpdateTime . ': '; ?
></td
>
230 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
235 if (isset($sts_data['Check_time']) && !empty($sts_data['Check_time'])) {
238 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatCheckTime . ': '; ?
></td
>
239 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
253 if ($cfg['ShowStats']) {
254 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
260  
;<b
><?php
echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?
></b
> 
;
262 <th align
="right" nowrap
="nowrap">
263 <b
><?php
echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?
></b
>
269 if ($cfg['ShowStats']) {
272 <th align
="right" nowrap
="nowrap">
273 <b
><?php
echo $sum_formated . ' ' . $unit; ?
></b
>
286 * Displays the footer
290 <script type
="text/javascript" language
="javascript1.2">
295 if (typeof(window
.print) != 'undefined') {
302 echo '<br /><br /> <input type="button" class="print_ignore" style="width: 100px; height: 25px" id="print" value="' . $strPrint . '" onclick="printPage()" />' . "\n";
304 require_once('./footer.inc.php');