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 informations on mysql >= 3.23.03
102 <th
><?php
echo __('Table'); ?
></th
>
103 <th
><?php
echo __('Rows'); ?
></th
>
104 <th
><?php
echo __('Type'); ?
></th
>
106 if ($cfg['ShowStats']) {
107 echo '<th>' . __('Size') . '</th>';
110 <th
><?php
echo __('Comments'); ?
></th
>
115 $sum_entries = $sum_size = 0;
117 foreach ($tables as $sts_data) {
118 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
119 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
122 $merged_size = false;
124 $sum_entries +
= $sts_data['TABLE_ROWS'];
126 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
128 <?php
echo htmlspecialchars($sts_data['TABLE_NAME']); ?
>
132 if (isset($sts_data['TABLE_ROWS'])) {
137 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
139 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
144 <?php
echo $sts_data['ENGINE']; ?
>
147 if ($cfg['ShowStats']) {
148 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
149 $sum_size +
= $tblsize;
150 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
152 <td align
="right" nowrap
="nowrap">
153 <?php
echo $formated_size . ' ' . $unit; ?
>
159 <td colspan
="3" align
="center">
160 <?php
echo __('in use'); ?
>
167 if (! empty($sts_data['Comment'])) {
168 echo htmlspecialchars($sts_data['Comment']);
169 $needs_break = '<br />';
174 if (! empty($sts_data['Create_time'])
175 ||
! empty($sts_data['Update_time'])
176 ||
! empty($sts_data['Check_time'])) {
182 if (! empty($sts_data['Create_time'])) {
185 <td align
="right"><?php
echo __('Creation') . ': '; ?
></td
>
186 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
191 if (! empty($sts_data['Update_time'])) {
194 <td align
="right"><?php
echo __('Last update') . ': '; ?
></td
>
195 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
200 if (! empty($sts_data['Check_time'])) {
203 <td align
="right"><?php
echo __('Last check') . ': '; ?
></td
>
204 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
220 <?php
echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?
>
222 <th align
="right" nowrap
="nowrap">
223 <?php
echo PMA_formatNumber($sum_entries, 0); ?
>
229 if ($cfg['ShowStats']) {
230 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
232 <th align
="right" nowrap
="nowrap">
233 <?php
echo $sum_formated . ' ' . $unit; ?
>
246 * Displays the footer
250 <script type
="text/javascript">
255 if (typeof(window
.print) != 'undefined') {
263 <input type
="button" class="print_ignore"
264 id
="print" value
="<?php echo __('Print'); ?>" onclick
="printPage()" />
267 require './libraries/footer.inc.php';