3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Gets the variables sent or posted to this script, then displays headers
9 require_once('./libraries/grab_globals.lib.php');
10 require_once('./header.inc.php');
13 require_once('./libraries/common.lib.php');
15 PMA_checkParameters(array('db'));
18 * Defines the url to return to in case of error in a sql statement
20 $err_url = 'db_details.php?' . PMA_generate_common_url($db);
23 * Settings for relations stuff
25 require_once('./libraries/relation.lib.php');
26 $cfgRelation = PMA_getRelationsParam();
29 * Gets the list of the table in the current db and informations about these
32 // staybyte: speedup view on locked tables - 11 June 2001
33 // Special speedup for newer MySQL Versions (in 4.0 format changed)
34 if ($cfg['SkipLockedTables'] == TRUE) {
35 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
36 // Blending out tables in use
37 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
38 while ($tmp = PMA_DBI_fetch_row($result)) {
39 // if in use memorize tablename
40 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
41 $sot_cache[$tmp[0]] = TRUE;
44 PMA_DBI_free_result($result);
47 if (isset($sot_cache)) {
48 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE
);
49 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
50 while ($tmp = PMA_DBI_fetch_row($result)) {
51 if (!isset($sot_cache[$tmp[0]])) {
52 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
53 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
55 } else { // table in use
56 $tables[] = array('Name' => $tmp[0]);
59 PMA_DBI_free_result($result);
66 if (!isset($sot_ready)) {
67 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
68 if (PMA_DBI_num_rows($result) > 0) {
69 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
72 PMA_DBI_free_result($result);
76 $num_tables = (isset($tables) ?
count($tables) : 0);
78 if ($cfgRelation['commwork']) {
79 $comment = PMA_getComments($db);
84 if (is_array($comment)) {
88 <?php
echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?
>
95 * If there is at least one table, displays the printer friendly view, else
99 if ($num_tables == 0) {
100 echo $strNoTablesFound;
102 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
106 <!-- The tables
list -->
107 <table border
="<?php echo $cfg['Border']; ?>">
109 <th
> 
;<?php
echo $strTable; ?
> 
;</th
>
110 <th
><?php
echo $strRecords; ?
></th
>
111 <th
><?php
echo $strType; ?
></th
>
113 if ($cfg['ShowStats']) {
114 echo '<th>' . $strSize . '</th>';
118 <th
><?php
echo $strComments; ?
></th
>
121 $i = $sum_entries = $sum_size = 0;
122 foreach ($tables AS $keyname => $sts_data) {
123 $table = $sts_data['Name'];
124 $bgcolor = ($i++ %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
128 <td bgcolor
="<?php echo $bgcolor; ?>" nowrap
="nowrap">
129  
;<b
><?php
echo htmlspecialchars($table); ?
> 
;</b
> 
;
135 if (isset($sts_data['Type'])) {
136 if ($sts_data['Type'] == 'MRG_MyISAM') {
138 } else if (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
143 if (isset($sts_data['Rows'])) {
144 if ($mergetable == FALSE) {
145 if ($cfg['ShowStats'] && $nonisam == FALSE) {
146 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
147 $sum_size +
= $tblsize;
149 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
151 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 0);
153 } else if ($cfg['ShowStats']) {
154 $formated_size = ' - ';
157 $sum_entries +
= $sts_data['Rows'];
159 // MyISAM MERGE Table
160 else if ($cfg['ShowStats'] && $mergetable == TRUE) {
161 $formated_size = ' - ';
164 else if ($cfg['ShowStats']) {
165 $formated_size = 'unknown';
169 <td align
="right" bgcolor
="<?php echo $bgcolor; ?>">
172 if ($mergetable == TRUE) {
173 echo '<i>' . number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
175 echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
179 <td nowrap
="nowrap" bgcolor
="<?php echo $bgcolor; ?>">
180  
;<?php
echo (isset($sts_data['Type']) ?
$sts_data['Type'] : ' '); ?
> 
;
183 if ($cfg['ShowStats']) {
186 <td align
="right" bgcolor
="<?php echo $bgcolor; ?>" nowrap
="nowrap">
187  
;<?php
echo $formated_size . ' ' . $unit . "\n"; ?
>
194 <td colspan
="3" align
="center" bgcolor
="<?php echo $bgcolor; ?>">
195 <?php
echo $strInUse . "\n"; ?
>
201 <td bgcolor
="<?php echo $bgcolor; ?>">
202 <?php
echo $sts_data['Comment']; ?
>
204 if (!empty($sts_data['Comment'])) {
205 $needs_break = '<br />';
210 if ((isset($sts_data['Create_time']) && !empty($sts_data['Create_time']))
211 ||
(isset($sts_data['Update_time']) && !empty($sts_data['Update_time']))
212 ||
(isset($sts_data['Check_time']) && !empty($sts_data['Check_time']))) {
215 <table border
="0" cellpadding
="1" cellspacing
="1" width
="100%">
218 if (isset($sts_data['Create_time']) && !empty($sts_data['Create_time'])) {
221 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatCreateTime . ': '; ?
></td
>
222 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
227 if (isset($sts_data['Update_time']) && !empty($sts_data['Update_time'])) {
230 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatUpdateTime . ': '; ?
></td
>
231 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
236 if (isset($sts_data['Check_time']) && !empty($sts_data['Check_time'])) {
239 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo $strStatCheckTime . ': '; ?
></td
>
240 <td style
="font-size: <?php echo $font_smaller; ?>" align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
254 if ($cfg['ShowStats']) {
255 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
261  
;<b
><?php
echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?
></b
> 
;
263 <th align
="right" nowrap
="nowrap">
264 <b
><?php
echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?
></b
>
270 if ($cfg['ShowStats']) {
273 <th align
="right" nowrap
="nowrap">
274 <b
><?php
echo $sum_formated . ' ' . $unit; ?
></b
>
287 * Displays the footer
291 <script type
="text/javascript" language
="javascript1.2">
295 document
.getElementById('print').style
.visibility
= 'hidden';
297 if (typeof(window
.print) != 'undefined') {
300 document
.getElementById('print').style
.visibility
= '';
305 echo '<br /><br /> <input type="button" style="visibility: ; width: 100px; height: 25px" id="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
307 require_once('./footer.inc.php');