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 require_once './libraries/relation.lib.php';
30 $cfgRelation = PMA_getRelationsParam();
33 * Gets the list of the table in the current db and informations about these
36 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
38 // speedup view on locked tables
39 // Special speedup for newer MySQL Versions (in 4.0 format changed)
40 if ($cfg['SkipLockedTables'] == true) {
41 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
42 // Blending out tables in use
43 if ($result != false && PMA_DBI_num_rows($result) > 0) {
44 while ($tmp = PMA_DBI_fetch_row($result)) {
45 // if in use memorize tablename
46 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
47 $sot_cache[$tmp[0]] = true;
50 PMA_DBI_free_result($result);
52 if (isset($sot_cache)) {
53 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
54 if ($result != false && PMA_DBI_num_rows($result) > 0) {
55 while ($tmp = PMA_DBI_fetch_row($result)) {
56 if (!isset($sot_cache[$tmp[0]])) {
57 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
58 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
60 } else { // table in use
61 $tables[] = array('Name' => $tmp[0]);
64 PMA_DBI_free_result($result);
72 if (! isset($sot_ready)) {
73 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
74 if (PMA_DBI_num_rows($result) > 0) {
75 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
78 PMA_DBI_free_result($result);
85 * If there is at least one table, displays the printer friendly view, else
88 $tables = PMA_DBI_get_tables_full($db);
89 $num_tables = count($tables);
94 if ($num_tables == 0) {
95 echo __('No tables found in database.');
97 // 2. Shows table informations on mysql >= 3.23.03
103 <th
><?php
echo __('Table'); ?
></th
>
104 <th
><?php
echo __('Rows'); ?
></th
>
105 <th
><?php
echo __('Type'); ?
></th
>
107 if ($cfg['ShowStats']) {
108 echo '<th>' . __('Size') . '</th>';
111 <th
><?php
echo __('Comments'); ?
></th
>
116 $sum_entries = $sum_size = 0;
118 foreach ($tables as $sts_data) {
119 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
120 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
123 $merged_size = false;
125 $sum_entries +
= $sts_data['TABLE_ROWS'];
127 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
129 <?php
echo htmlspecialchars($sts_data['TABLE_NAME']); ?
>
133 if (isset($sts_data['TABLE_ROWS'])) {
138 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
140 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
145 <?php
echo $sts_data['ENGINE']; ?
>
148 if ($cfg['ShowStats']) {
149 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
150 $sum_size +
= $tblsize;
151 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
153 <td align
="right" nowrap
="nowrap">
154 <?php
echo $formated_size . ' ' . $unit; ?
>
160 <td colspan
="3" align
="center">
161 <?php
echo __('in use'); ?
>
168 if (! empty($sts_data['Comment'])) {
169 echo htmlspecialchars($sts_data['Comment']);
170 $needs_break = '<br />';
175 if (! empty($sts_data['Create_time'])
176 ||
! empty($sts_data['Update_time'])
177 ||
! empty($sts_data['Check_time'])) {
183 if (! empty($sts_data['Create_time'])) {
186 <td align
="right"><?php
echo __('Creation') . ': '; ?
></td
>
187 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
192 if (! empty($sts_data['Update_time'])) {
195 <td align
="right"><?php
echo __('Last update') . ': '; ?
></td
>
196 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
201 if (! empty($sts_data['Check_time'])) {
204 <td align
="right"><?php
echo __('Last check') . ': '; ?
></td
>
205 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
221 <?php
echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?
>
223 <th align
="right" nowrap
="nowrap">
224 <?php
echo PMA_formatNumber($sum_entries, 0); ?
>
230 if ($cfg['ShowStats']) {
231 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
233 <th align
="right" nowrap
="nowrap">
234 <?php
echo $sum_formated . ' ' . $unit; ?
>
247 * Displays the footer
251 <script type
="text/javascript">
256 if (typeof(window
.print) != 'undefined') {
264 <input type
="button" class="print_ignore"
265 id
="print" value
="<?php echo __('Print'); ?>" onclick
="printPage()" />
268 require_once './libraries/footer.inc.php';