Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/InfoController.php')
-rw-r--r--src/controllers/InfoController.php602
1 files changed, 319 insertions, 283 deletions
diff --git a/src/controllers/InfoController.php b/src/controllers/InfoController.php
index 8a66ae30..c702e2d0 100644
--- a/src/controllers/InfoController.php
+++ b/src/controllers/InfoController.php
@@ -51,7 +51,7 @@ class InfoController extends BaseController
$this->printMsg($msg);
// common params for printVal
- $shownull = ['null' => true];
+ $this->shownull = ['null' => true];
// Fetch info
$referrers = $data->getReferrers($_REQUEST['table']);
@@ -68,306 +68,342 @@ class InfoController extends BaseController
&& (0 == $tablestatstups->recordCount() && 0 == $tablestatsio->recordCount()
&& 0 == $indexstatstups->recordCount() && 0 == $indexstatsio->recordCount())) {
$this->printMsg($this->lang['strnoinfo']);
- } else {
- // Referring foreign tables
- if ($referrers !== -99 && $referrers->recordCount() > 0) {
- echo "<h3>{$this->lang['strreferringtables']}</h3>".PHP_EOL;
-
- $columns = [
- 'schema' => [
- 'title' => $this->lang['strschema'],
- 'field' => Decorator::field('nspname'),
- ],
- 'table' => [
- 'title' => $this->lang['strtable'],
- 'field' => Decorator::field('relname'),
- ],
- 'name' => [
- 'title' => $this->lang['strname'],
- 'field' => Decorator::field('conname'),
- ],
- 'definition' => [
- 'title' => $this->lang['strdefinition'],
- 'field' => Decorator::field('consrc'),
- ],
- 'actions' => [
- 'title' => $this->lang['stractions'],
- ],
- ];
-
- $actions = [
- 'properties' => [
- 'content' => $this->lang['strproperties'],
- 'attr' => [
- 'href' => [
- 'url' => 'constraints',
- 'urlvars' => [
- 'schema' => Decorator::field('nspname'),
- 'table' => Decorator::field('relname'),
- ],
- ],
- ],
- ],
- ];
- echo $this->printTable($referrers, $columns, $actions, 'info-referrers', $this->lang['strnodata']);
- }
+ return;
+ }
+ // Referring foreign tables
+ if ($referrers !== -99 && $referrers->recordCount() > 0) {
+ $this->_printReferring($referrers);
+ }
- // Parent tables
- if ($parents->recordCount() > 0) {
- echo "<h3>{$this->lang['strparenttables']}</h3>".PHP_EOL;
+ // Parent tables
+ if ($parents->recordCount() > 0) {
+ $this->_printParents($parents);
+ }
- $columns = [
- 'schema' => [
- 'title' => $this->lang['strschema'],
- 'field' => Decorator::field('nspname'),
- ],
- 'table' => [
- 'title' => $this->lang['strtable'],
- 'field' => Decorator::field('relname'),
- ],
- 'actions' => [
- 'title' => $this->lang['stractions'],
- ],
- ];
-
- $actions = [
- 'properties' => [
- 'content' => $this->lang['strproperties'],
- 'attr' => [
- 'href' => [
- 'url' => 'tblproperties',
- 'urlvars' => [
- 'schema' => Decorator::field('nspname'),
- 'table' => Decorator::field('relname'),
- ],
- ],
- ],
- ],
- ];
+ // Child tables
+ if ($children->recordCount() > 0) {
+ $this->_printChildren($children);
+ }
- echo $this->printTable($parents, $columns, $actions, 'info-parents', $this->lang['strnodata']);
- }
+ // Row performance
+ if ($tablestatstups->recordCount() > 0) {
+ $this->_printTablestatstups($tablestatstups);
+ }
- // Child tables
- if ($children->recordCount() > 0) {
- echo "<h3>{$this->lang['strchildtables']}</h3>".PHP_EOL;
+ // I/O performance
+ if ($tablestatsio->recordCount() > 0) {
+ $this->_printTablestatsio($tablestatsio);
+ }
- $columns = [
- 'schema' => [
- 'title' => $this->lang['strschema'],
- 'field' => Decorator::field('nspname'),
- ],
- 'table' => [
- 'title' => $this->lang['strtable'],
- 'field' => Decorator::field('relname'),
- ],
- 'actions' => [
- 'title' => $this->lang['stractions'],
- ],
- ];
-
- $actions = [
- 'properties' => [
- 'content' => $this->lang['strproperties'],
- 'attr' => [
- 'href' => [
- 'url' => 'tblproperties',
- 'urlvars' => [
- 'schema' => Decorator::field('nspname'),
- 'table' => Decorator::field('relname'),
- ],
- ],
+ // Index row performance
+ if ($indexstatstups->recordCount() > 0) {
+ $this->_printIndexstatstups($indexstatstups);
+ }
+
+ // Index I/0 performance
+ if ($indexstatsio->recordCount() > 0) {
+ $this->_printIndexstatsio($indexstatsio);
+ }
+ }
+
+ private function _printChildren($children)
+ {
+ echo "<h3>{$this->lang['strchildtables']}</h3>".PHP_EOL;
+
+ $columns = [
+ 'schema' => [
+ 'title' => $this->lang['strschema'],
+ 'field' => Decorator::field('nspname'),
+ ],
+ 'table' => [
+ 'title' => $this->lang['strtable'],
+ 'field' => Decorator::field('relname'),
+ ],
+ 'actions' => [
+ 'title' => $this->lang['stractions'],
+ ],
+ ];
+
+ $actions = [
+ 'properties' => [
+ 'content' => $this->lang['strproperties'],
+ 'attr' => [
+ 'href' => [
+ 'url' => 'tblproperties',
+ 'urlvars' => [
+ 'schema' => Decorator::field('nspname'),
+ 'table' => Decorator::field('relname'),
],
],
- ];
+ ],
+ ],
+ ];
+
+ echo $this->printTable($children, $columns, $actions, 'info-children', $this->lang['strnodata']);
+ }
+
+ private function _printTablestatstups($tablestatstups)
+ {
+ echo "<h3>{$this->lang['strrowperf']}</h3>".PHP_EOL;
+
+ echo '<table>'.PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"2\">{$this->lang['strsequential']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"2\">{$this->lang['strindex']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strrows2']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strread']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strfetch']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strinsert']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strupdate']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdelete']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $i = 0;
+
+ while (!$tablestatstups->EOF) {
+ $id = (0 == ($i % 2) ? '1' : '2');
+ echo "\t<tr class=\"data{$id}\">".PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['seq_scan'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['seq_tup_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['idx_scan'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['idx_tup_fetch'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_ins'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_upd'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_del'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $tablestatstups->movenext();
+ ++$i;
+ }
+
+ echo '</table>'.PHP_EOL;
+ }
- echo $this->printTable($children, $columns, $actions, 'info-children', $this->lang['strnodata']);
+ private function _printTablestatsio($tablestatsio)
+ {
+ echo "<h3>{$this->lang['strioperf']}</h3>".PHP_EOL;
+
+ echo '<table>'.PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strheap']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strindex']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strtoast']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strtoastindex']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $i = 0;
+
+ while (!$tablestatsio->EOF) {
+ $id = (0 == ($i % 2) ? '1' : '2');
+ echo "\t<tr class=\"data{$id}\">".PHP_EOL;
+
+ $total = $tablestatsio->fields['heap_blks_hit'] + $tablestatsio->fields['heap_blks_read'];
+ if ($total > 0) {
+ $percentage = round(($tablestatsio->fields['heap_blks_hit'] / $total) * 100);
+ } else {
+ $percentage = 0;
}
- // Row performance
- if ($tablestatstups->recordCount() > 0) {
- echo "<h3>{$this->lang['strrowperf']}</h3>".PHP_EOL;
-
- echo '<table>'.PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"2\">{$this->lang['strsequential']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"2\">{$this->lang['strindex']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strrows2']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strread']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strfetch']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strinsert']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strupdate']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdelete']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $i = 0;
-
- while (!$tablestatstups->EOF) {
- $id = (0 == ($i % 2) ? '1' : '2');
- echo "\t<tr class=\"data{$id}\">".PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['seq_scan'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['seq_tup_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['idx_scan'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['idx_tup_fetch'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_ins'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_upd'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatstups->fields['n_tup_del'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $tablestatstups->movenext();
- ++$i;
- }
-
- echo '</table>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_hit'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
+
+ $total = $tablestatsio->fields['idx_blks_hit'] + $tablestatsio->fields['idx_blks_read'];
+ if ($total > 0) {
+ $percentage = round(($tablestatsio->fields['idx_blks_hit'] / $total) * 100);
+ } else {
+ $percentage = 0;
}
- // I/O performance
- if ($tablestatsio->recordCount() > 0) {
- echo "<h3>{$this->lang['strioperf']}</h3>".PHP_EOL;
-
- echo '<table>'.PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strheap']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strindex']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strtoast']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\" colspan=\"3\">{$this->lang['strtoastindex']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $i = 0;
-
- while (!$tablestatsio->EOF) {
- $id = (0 == ($i % 2) ? '1' : '2');
- echo "\t<tr class=\"data{$id}\">".PHP_EOL;
-
- $total = $tablestatsio->fields['heap_blks_hit'] + $tablestatsio->fields['heap_blks_read'];
- if ($total > 0) {
- $percentage = round(($tablestatsio->fields['heap_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
-
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_hit'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
-
- $total = $tablestatsio->fields['idx_blks_hit'] + $tablestatsio->fields['idx_blks_read'];
- if ($total > 0) {
- $percentage = round(($tablestatsio->fields['idx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
-
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_hit'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
-
- $total = $tablestatsio->fields['toast_blks_hit'] + $tablestatsio->fields['toast_blks_read'];
- if ($total > 0) {
- $percentage = round(($tablestatsio->fields['toast_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
-
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_hit'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
-
- $total = $tablestatsio->fields['tidx_blks_hit'] + $tablestatsio->fields['tidx_blks_read'];
- if ($total > 0) {
- $percentage = round(($tablestatsio->fields['tidx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
-
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_hit'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $tablestatsio->movenext();
- ++$i;
- }
-
- echo '</table>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_hit'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
+
+ $total = $tablestatsio->fields['toast_blks_hit'] + $tablestatsio->fields['toast_blks_read'];
+ if ($total > 0) {
+ $percentage = round(($tablestatsio->fields['toast_blks_hit'] / $total) * 100);
+ } else {
+ $percentage = 0;
}
- // Index row performance
- if ($indexstatstups->recordCount() > 0) {
- echo "<h3>{$this->lang['stridxrowperf']}</h3>".PHP_EOL;
-
- echo '<table>'.PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strindex']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strread']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strfetch']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $i = 0;
-
- while (!$indexstatstups->EOF) {
- $id = (0 == ($i % 2) ? '1' : '2');
- echo "\t<tr class=\"data{$id}\">".PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['indexrelname']), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_scan'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_tup_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_tup_fetch'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $indexstatstups->movenext();
- ++$i;
- }
-
- echo '</table>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_hit'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
+
+ $total = $tablestatsio->fields['tidx_blks_hit'] + $tablestatsio->fields['tidx_blks_read'];
+ if ($total > 0) {
+ $percentage = round(($tablestatsio->fields['tidx_blks_hit'] / $total) * 100);
+ } else {
+ $percentage = 0;
}
- // Index I/0 performance
- if ($indexstatsio->recordCount() > 0) {
- echo "<h3>{$this->lang['stridxioperf']}</h3>".PHP_EOL;
-
- echo '<table>'.PHP_EOL;
- echo "\t<tr>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strindex']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
- echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $i = 0;
-
- while (!$indexstatsio->EOF) {
- $id = (0 == ($i % 2) ? '1' : '2');
- echo "\t<tr class=\"data{$id}\">".PHP_EOL;
- $total = $indexstatsio->fields['idx_blks_hit'] + $indexstatsio->fields['idx_blks_read'];
- if ($total > 0) {
- $percentage = round(($indexstatsio->fields['idx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
-
- echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['indexrelname']), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['idx_blks_read'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['idx_blks_hit'], 'int4', $shownull), '</td>'.PHP_EOL;
- echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
- echo "\t</tr>".PHP_EOL;
- $indexstatsio->movenext();
- ++$i;
- }
-
- echo '</table>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_hit'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $tablestatsio->movenext();
+ ++$i;
+ }
+
+ echo '</table>'.PHP_EOL;
+ }
+
+ private function _printIndexstatstups($indexstatstups)
+ {
+ echo "<h3>{$this->lang['stridxrowperf']}</h3>".PHP_EOL;
+
+ echo '<table>'.PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strindex']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strscan']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strread']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strfetch']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $i = 0;
+
+ while (!$indexstatstups->EOF) {
+ $id = (0 == ($i % 2) ? '1' : '2');
+ echo "\t<tr class=\"data{$id}\">".PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['indexrelname']), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_scan'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_tup_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatstups->fields['idx_tup_fetch'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $indexstatstups->movenext();
+ ++$i;
+ }
+
+ echo '</table>'.PHP_EOL;
+ }
+
+ private function _printIndexstatsio($indexstatsio)
+ {
+ echo "<h3>{$this->lang['stridxioperf']}</h3>".PHP_EOL;
+
+ echo '<table>'.PHP_EOL;
+ echo "\t<tr>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strindex']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strdisk']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strcache']}</th>".PHP_EOL;
+ echo "\t\t<th class=\"data\">{$this->lang['strpercent']}</th>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $i = 0;
+
+ while (!$indexstatsio->EOF) {
+ $id = (0 == ($i % 2) ? '1' : '2');
+ echo "\t<tr class=\"data{$id}\">".PHP_EOL;
+ $total = $indexstatsio->fields['idx_blks_hit'] + $indexstatsio->fields['idx_blks_read'];
+ if ($total > 0) {
+ $percentage = round(($indexstatsio->fields['idx_blks_hit'] / $total) * 100);
+ } else {
+ $percentage = 0;
}
+
+ echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['indexrelname']), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['idx_blks_read'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['idx_blks_hit'], 'int4', $this->shownull), '</td>'.PHP_EOL;
+ echo "\t\t<td>({$percentage}{$this->lang['strpercent']})</td>".PHP_EOL;
+ echo "\t</tr>".PHP_EOL;
+ $indexstatsio->movenext();
+ ++$i;
}
+
+ echo '</table>'.PHP_EOL;
+ }
+
+ private function _printParents($parents)
+ {
+ echo "<h3>{$this->lang['strparenttables']}</h3>".PHP_EOL;
+
+ $columns = [
+ 'schema' => [
+ 'title' => $this->lang['strschema'],
+ 'field' => Decorator::field('nspname'),
+ ],
+ 'table' => [
+ 'title' => $this->lang['strtable'],
+ 'field' => Decorator::field('relname'),
+ ],
+ 'actions' => [
+ 'title' => $this->lang['stractions'],
+ ],
+ ];
+
+ $actions = [
+ 'properties' => [
+ 'content' => $this->lang['strproperties'],
+ 'attr' => [
+ 'href' => [
+ 'url' => 'tblproperties',
+ 'urlvars' => [
+ 'schema' => Decorator::field('nspname'),
+ 'table' => Decorator::field('relname'),
+ ],
+ ],
+ ],
+ ],
+ ];
+
+ echo $this->printTable($parents, $columns, $actions, 'info-parents', $this->lang['strnodata']);
+ }
+
+ private function _printReferring($referrers)
+ {
+ echo "<h3>{$this->lang['strreferringtables']}</h3>".PHP_EOL;
+
+ $columns = [
+ 'schema' => [
+ 'title' => $this->lang['strschema'],
+ 'field' => Decorator::field('nspname'),
+ ],
+ 'table' => [
+ 'title' => $this->lang['strtable'],
+ 'field' => Decorator::field('relname'),
+ ],
+ 'name' => [
+ 'title' => $this->lang['strname'],
+ 'field' => Decorator::field('conname'),
+ ],
+ 'definition' => [
+ 'title' => $this->lang['strdefinition'],
+ 'field' => Decorator::field('consrc'),
+ ],
+ 'actions' => [
+ 'title' => $this->lang['stractions'],
+ ],
+ ];
+
+ $actions = [
+ 'properties' => [
+ 'content' => $this->lang['strproperties'],
+ 'attr' => [
+ 'href' => [
+ 'url' => 'constraints',
+ 'urlvars' => [
+ 'schema' => Decorator::field('nspname'),
+ 'table' => Decorator::field('relname'),
+ ],
+ ],
+ ],
+ ],
+ ];
+
+ echo $this->printTable($referrers, $columns, $actions, 'info-referrers', $this->lang['strnodata']);
}
}