32 ?
object $a_parent_obj,
35 protected string $mode =
"chronological" 39 $this->
ctrl = $DIC->ctrl();
40 $this->
lng = $DIC->language();
41 $this->
access = $DIC->access();
42 $ilCtrl = $DIC->ctrl();
43 $lng = $DIC->language();
44 $ilAccess = $DIC->access();
45 $lng = $DIC->language();
50 switch ($this->mode) {
65 case "by_first_table":
83 $this->
setRowTemplate(
"tpl.db_bench.html",
"Modules/SystemFolder");
91 public function getFirst(
string $a_str, array $a_needles):
int 94 foreach ($a_needles as $needle) {
95 $pos2 = strpos($a_str, (
string) $needle);
97 if ($pos2 > 0 && ($pos2 < $pos || $pos === 0)) {
110 $pos1 = $this->
getFirst(strtolower($a_sql), [
"from ",
"from\n",
"from\t",
"from\r"]);
114 $tablef = substr(strtolower($a_sql), $pos1 + 5);
115 $pos2 = $this->
getFirst($tablef, [
" ",
"\n",
"\t",
"\r"]);
116 $table = $pos2 > 0 ? substr($tablef, 0, $pos2) : $tablef;
118 if (trim($table) !==
"") {
131 foreach ($a_records as
$r) {
133 if (trim($table) ===
'') {
136 $data[$table][
"table"] = $table;
137 if (!isset(
$data[$table][
"cnt"])) {
138 $data[$table][
"cnt"] = 1;
140 $data[$table][
"cnt"]++;
142 if (!isset(
$data[$table][
"time"])) {
143 $data[$table][
"time"] = $r[
"time"];
145 $data[$table][
"time"] += $r[
"time"];
158 protected function fillRow(array $a_set): void
162 switch ($this->mode) {
163 case "by_first_table":
164 $this->tpl->setCurrentBlock(
"td");
165 $this->tpl->setVariable(
"VAL", $a_set[
"table"]);
166 $this->tpl->parseCurrentBlock();
167 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
168 $this->tpl->setVariable(
"VAL2", $a_set[
"cnt"]);
171 case "slowest_first":
172 case "sorted_by_sql":
174 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
175 $this->tpl->setVariable(
"VAL2", $a_set[
"sql"]);
extractFirstTableFromSQL(string $a_sql)
Extract first table from sql.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
fillRow(array $a_set)
Fill table row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDataByFirstTable(array $a_records)
Get data by first table.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(?object $a_parent_obj, string $a_parent_cmd, array $a_records, protected string $mode="chronological")
Constructor.
setLimit(int $a_limit=0, int $a_default_limit=0)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
getFirst(string $a_str, array $a_needles)
Get first occurence of string.
setEnableHeader(bool $a_enableheader)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)