4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
20 function __construct($a_parent_obj, $a_parent_cmd, $a_records, $a_mode =
"chronological")
26 $this->mode = $a_mode;
32 $this->
setTitle($lng->txt(
"adm_db_bench_slowest_first"));
33 $this->
addColumn($this->lng->txt(
"adm_time"));
34 $this->
addColumn($this->lng->txt(
"adm_sql"));
39 $this->
setTitle($lng->txt(
"adm_db_bench_sorted_by_sql"));
40 $this->
addColumn($this->lng->txt(
"adm_time"));
41 $this->
addColumn($this->lng->txt(
"adm_sql"));
44 case "by_first_table":
46 $this->
setTitle($lng->txt(
"adm_db_bench_by_first_table"));
47 $this->
addColumn($this->lng->txt(
"adm_time"));
48 $this->
addColumn($this->lng->txt(
"adm_nr_statements"));
49 $this->
addColumn($this->lng->txt(
"adm_table"));
54 $this->
setTitle($lng->txt(
"adm_db_bench_chronological"));
55 $this->
addColumn($this->lng->txt(
"adm_time"));
56 $this->
addColumn($this->lng->txt(
"adm_sql"));
63 $this->
setRowTemplate(
"tpl.db_bench.html",
"Modules/SystemFolder");
80 foreach ($a_needles as $needle)
82 $pos2 = strpos($a_str, $needle);
84 if ($pos2 > 0 && ($pos2 <
$pos ||
$pos == 0))
101 $pos1 = $this->
getFirst(strtolower($a_sql), array(
"from ",
"from\n",
"from\t",
"from\r"));
106 $tablef = substr(strtolower($a_sql), $pos1+5);
107 $pos2 = $this->
getFirst($tablef, array(
" ",
"\n",
"\t",
"\r"));
110 $table =substr($tablef, 0, $pos2);
117 if (trim($table) !=
"")
135 foreach ($a_records as $r)
138 $data[$table][
"table"] = $table;
139 $data[$table][
"cnt"]++;
140 $data[$table][
"time"] += $r[
"time"];
142 if (count(
$data) > 0)
159 case "by_first_table":
160 $this->tpl->setCurrentBlock(
"td");
161 $this->tpl->setVariable(
"VAL", $a_set[
"table"]);
162 $this->tpl->parseCurrentBlock();
163 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
164 $this->tpl->setVariable(
"VAL2", $a_set[
"cnt"]);
167 case "slowest_first":
168 case "sorted_by_sql":
170 $this->tpl->setVariable(
"VAL1", $a_set[
"time"]);
171 $this->tpl->setVariable(
"VAL2", $a_set[
"sql"]);