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 './libraries/header.inc.php';
13 PMA_checkParameters(array('db'));
16 * Defines the url to return to in case of error in a sql statement
18 $err_url = 'db_details.php?' . PMA_generate_common_url($db);
21 * Settings for relations stuff
23 require_once './libraries/relation.lib.php';
24 $cfgRelation = PMA_getRelationsParam();
27 * Gets the list of the table in the current db and informations about these
30 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
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);
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);
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);
79 * If there is at least one table, displays the printer friendly view, else
82 $tables = PMA_DBI_get_tables_full($db);
83 $num_tables = count($tables);
88 if ($num_tables == 0) {
89 echo $strNoTablesFound;
91 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
97 <th
><?php
echo $strTable; ?
></th
>
98 <th
><?php
echo $strRecords; ?
></th
>
99 <th
><?php
echo $strType; ?
></th
>
101 if ($cfg['ShowStats']) {
102 echo '<th>' . $strSize . '</th>';
105 <th
><?php
echo $strComments; ?
></th
>
110 $sum_entries = $sum_size = 0;
112 foreach ($tables as $sts_data) {
113 if (strtoupper($sts_data['ENGINE']) == 'MRG_MYISAM'
114 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
117 $merged_size = false;
119 $sum_entries +
= $sts_data['TABLE_ROWS'];
121 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
123 <?php
echo htmlspecialchars($sts_data['TABLE_NAME']); ?
>
127 if (isset($sts_data['TABLE_ROWS'])) {
132 echo '<i>' . number_format($sts_data['TABLE_ROWS'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
134 echo number_format($sts_data['TABLE_ROWS'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
139 <?php
echo $sts_data['ENGINE']; ?
>
142 if ($cfg['ShowStats']) {
143 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
144 $sum_size +
= $tblsize;
145 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
147 <td align
="right" nowrap
="nowrap">
148 <?php
echo $formated_size . ' ' . $unit; ?
>
154 <td colspan
="3" align
="center">
155 <?php
echo $strInUse; ?
>
162 if (! empty($sts_data['Comment'])) {
163 echo $sts_data['Comment'];
164 $needs_break = '<br />';
169 if (! empty($sts_data['Create_time'])
170 ||
! empty($sts_data['Update_time'])
171 ||
! empty($sts_data['Check_time'])) {
177 if (! empty($sts_data['Create_time'])) {
180 <td align
="right"><?php
echo $strStatCreateTime . ': '; ?
></td
>
181 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
186 if (! empty($sts_data['Update_time'])) {
189 <td align
="right"><?php
echo $strStatUpdateTime . ': '; ?
></td
>
190 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
195 if (! empty($sts_data['Check_time'])) {
198 <td align
="right"><?php
echo $strStatCheckTime . ': '; ?
></td
>
199 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
215 <?php
echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?
>
217 <th align
="right" nowrap
="nowrap">
218 <?php
echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?
>
224 if ($cfg['ShowStats']) {
225 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
227 <th align
="right" nowrap
="nowrap">
228 <?php
echo $sum_formated . ' ' . $unit; ?
>
241 * Displays the footer
245 <script type
="text/javascript" language
="javascript">
250 if (typeof(window
.print) != 'undefined') {
258 <input type
="button" class="print_ignore"
259 id
="print" value
="<?php echo $strPrint; ?>" onclick
="printPage()" />
262 require_once './libraries/footer.inc.php';