2 /* vim: set expandtab sw=4 ts=4 sts=4: */
12 require_once './libraries/common.inc.php';
15 * Gets the variables sent or posted to this script, then displays headers
18 require_once './libraries/header.inc.php';
20 PMA_checkParameters(array('db'));
23 * Defines the url to return to in case of error in a sql statement
25 $err_url = 'db_sql.php?' . PMA_generate_common_url($db);
28 * Settings for relations stuff
30 require_once './libraries/relation.lib.php';
31 $cfgRelation = PMA_getRelationsParam();
34 * Gets the list of the table in the current db and informations about these
37 * @todo merge this speedup _optionaly_ into PMA_DBI_get_tables_full()
39 // speedup view on locked tables
40 // Special speedup for newer MySQL Versions (in 4.0 format changed)
41 if ($cfg['SkipLockedTables'] == true) {
42 $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
43 // Blending out tables in use
44 if ($result != false && PMA_DBI_num_rows($result) > 0) {
45 while ($tmp = PMA_DBI_fetch_row($result)) {
46 // if in use memorize tablename
47 if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
48 $sot_cache[$tmp[0]] = true;
51 PMA_DBI_free_result($result);
53 if (isset($sot_cache)) {
54 $result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
55 if ($result != false && PMA_DBI_num_rows($result) > 0) {
56 while ($tmp = PMA_DBI_fetch_row($result)) {
57 if (!isset($sot_cache[$tmp[0]])) {
58 $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
59 $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
61 } else { // table in use
62 $tables[] = array('Name' => $tmp[0]);
65 PMA_DBI_free_result($result);
73 if (! isset($sot_ready)) {
74 $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
75 if (PMA_DBI_num_rows($result) > 0) {
76 while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
79 PMA_DBI_free_result($result);
86 * If there is at least one table, displays the printer friendly view, else
89 $tables = PMA_DBI_get_tables_full($db);
90 $num_tables = count($tables);
95 if ($num_tables == 0) {
96 echo __('No tables found in database.');
98 // 2. Shows table informations on mysql >= 3.23.03
104 <th
><?php
echo __('Table'); ?
></th
>
105 <th
><?php
echo __('Rows'); ?
></th
>
106 <th
><?php
echo __('Type'); ?
></th
>
108 if ($cfg['ShowStats']) {
109 echo '<th>' . __('Size') . '</th>';
112 <th
><?php
echo __('Comments'); ?
></th
>
117 $sum_entries = $sum_size = 0;
119 foreach ($tables as $sts_data) {
120 if (PMA_Table
::isMerge($db, $sts_data['TABLE_NAME'])
121 ||
strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
124 $merged_size = false;
126 $sum_entries +
= $sts_data['TABLE_ROWS'];
128 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
130 <?php
echo htmlspecialchars($sts_data['TABLE_NAME']); ?
>
134 if (isset($sts_data['TABLE_ROWS'])) {
139 echo '<i>' . PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . '</i>' . "\n";
141 echo PMA_formatNumber($sts_data['TABLE_ROWS'], 0) . "\n";
146 <?php
echo $sts_data['ENGINE']; ?
>
149 if ($cfg['ShowStats']) {
150 $tblsize = $sts_data['Data_length'] +
$sts_data['Index_length'];
151 $sum_size +
= $tblsize;
152 list($formated_size, $unit) = PMA_formatByteDown($tblsize, 3, 1);
154 <td align
="right" nowrap
="nowrap">
155 <?php
echo $formated_size . ' ' . $unit; ?
>
161 <td colspan
="3" align
="center">
162 <?php
echo __('in use'); ?
>
169 if (! empty($sts_data['Comment'])) {
170 echo htmlspecialchars($sts_data['Comment']);
171 $needs_break = '<br />';
176 if (! empty($sts_data['Create_time'])
177 ||
! empty($sts_data['Update_time'])
178 ||
! empty($sts_data['Check_time'])) {
184 if (! empty($sts_data['Create_time'])) {
187 <td align
="right"><?php
echo __('Creation') . ': '; ?
></td
>
188 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?
></td
>
193 if (! empty($sts_data['Update_time'])) {
196 <td align
="right"><?php
echo __('Last update') . ': '; ?
></td
>
197 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?
></td
>
202 if (! empty($sts_data['Check_time'])) {
205 <td align
="right"><?php
echo __('Last check') . ': '; ?
></td
>
206 <td align
="right"><?php
echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?
></td
>
222 <?php
echo sprintf(_ngettext('%s table', '%s tables', $num_tables), PMA_formatNumber($num_tables, 0)); ?
>
224 <th align
="right" nowrap
="nowrap">
225 <?php
echo PMA_formatNumber($sum_entries, 0); ?
>
231 if ($cfg['ShowStats']) {
232 list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
234 <th align
="right" nowrap
="nowrap">
235 <?php
echo $sum_formated . ' ' . $unit; ?
>
248 * Displays the footer
252 <script type
="text/javascript">
257 if (typeof(window
.print) != 'undefined') {
265 <input type
="button" class="print_ignore"
266 id
="print" value
="<?php echo __('Print'); ?>" onclick
="printPage()" />
269 require_once './libraries/footer.inc.php';