2 /* vim: set expandtab sw=4 ts=4 sts=4: */
11 require_once './libraries/common.inc.php';
14 * Gets the variables sent or posted to this script, then displays headers
17 require_once './libraries/header.inc.php';
19 PMA_checkParameters(array('db'));
22 * Defines the url to return to in case of error in a sql statement
24 $err_url = 'db_sql.php?' . PMA_generate_common_url($db);
27 * Settings for relations stuff
29 $cfgRelation = PMA_getRelationsParam();
32 * Gets the list of the table in the current db and informations about these
35 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
37 // speedup view on locked tables
38 // Special speedup for newer MySQL Versions (in 4.0 format changed)
39 if ($cfg['SkipLockedTables'] == true) {
40 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
41 // Blending out tables in use
42 if ($result != false && PMA_DBI_num_rows($result) > 0) {
43 while ($tmp = PMA_DBI_fetch_row($result)) {
44 // if in use memorize tablename
45 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
46 $sot_cache[$tmp[0]] = true;
49 PMA_DBI_free_result($result);
51 if (isset($sot_cache)) {
52 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
53 if ($result != false && PMA_DBI_num_rows($result) > 0) {
54 while ($tmp = PMA_DBI_fetch_row($result)) {
55 if (! isset($sot_cache[$tmp[0]])) {
56 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddSlashes($tmp[0], true) . '\';');
57 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
59 } else { // table in use
60 $tables[] = array('Name' => $tmp[0]);
63 PMA_DBI_free_result($result);
71 if (! isset($sot_ready)) {
72 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
73 if (PMA_DBI_num_rows($result) > 0) {
74 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
77 PMA_DBI_free_result($result);
84 * If there is at least one table, displays the printer friendly view, else
87 $tables = PMA_DBI_get_tables_full($db);
88 $num_tables = count($tables);
93 if ($num_tables == 0) {
94 echo __('No tables found in database.');
96 // 2. Shows table information
101 <th
><?php
echo __('Table'); ?
></th
>
102 <th
><?php
echo __('Rows'); ?
></th
>
103 <th
><?php
echo __('Type'); ?
></th
>
105 if ($cfg['ShowStats']) {
106 echo '<th>' . __('Size') . '</th>';
109 <th
><?php
echo __('Comments'); ?
></th
>
114 $sum_entries = $sum_size = 0;
116 foreach ($tables as $sts_data) {
117 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
118 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
121 $merged_size = false;
123 $sum_entries +
= $sts_data['TABLE_ROWS'];
125 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
127 <?php
echo htmlspecialchars($sts_data['TABLE_NAME']); ?
>
131 if (isset($sts_data['TABLE_ROWS'])) {
136 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
138 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
143 <?php
echo $sts_data['ENGINE']; ?
>
146 if ($cfg['ShowStats']) {
147 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
148 $sum_size +
= $tblsize;
149 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
151 <td align
="right" nowrap
="nowrap">
152 <?php
echo $formated_size . ' ' . $unit; ?
>
158 <td colspan
="3" align
="center">
159 <?php
echo __('in use'); ?
>
166 if (! empty($sts_data['Comment'])) {
167 echo htmlspecialchars($sts_data['Comment']);
168 $needs_break = '<br />';
173 if (! empty($sts_data['Create_time'])
174 ||
! empty($sts_data['Update_time'])
175 ||
! empty($sts_data['Check_time'])) {
181 if (! empty($sts_data['Create_time'])) {
184 <td align
="right"><?php
echo __('Creation') . ': '; ?
></td
>
185 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
190 if (! empty($sts_data['Update_time'])) {
193 <td align
="right"><?php
echo __('Last update') . ': '; ?
></td
>
194 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
199 if (! empty($sts_data['Check_time'])) {
202 <td align
="right"><?php
echo __('Last check') . ': '; ?
></td
>
203 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
219 <?php
echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?
>
221 <th align
="right" nowrap
="nowrap">
222 <?php
echo PMA_formatNumber($sum_entries, 0); ?
>
228 if ($cfg['ShowStats']) {
229 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
231 <th align
="right" nowrap
="nowrap">
232 <?php
echo $sum_formated . ' ' . $unit; ?
>
245 * Displays the footer
249 echo "<div id='PMA_disable_floating_menubar'></div>\n";
251 require './libraries/footer.inc.php';