Link to EXPLAIN output

This commit is contained in:
Jakub Vrana 2010-12-10 17:54:57 +01:00
parent 3fad0c6ef7
commit 5a2c0646d4
2 changed files with 4 additions and 3 deletions

View file

@ -4,7 +4,7 @@
* @param Min_DB connection to examine indexes
* @return null
*/
function select($result, $connection2 = null) {
function select($result, $connection2 = null, $href = "") {
$links = array(); // colno => orgtable - create links from these columns
$indexes = array(); // orgtable => array(column => colno) - primary keys
$columns = array(); // orgtable => array(column => ) - not selected columns in primary key
@ -41,7 +41,8 @@ function select($result, $connection2 = null) {
$blobs[$j] = true;
}
$types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($field->name);
$name = h($field->name);
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . ($href ? "<a href='$href" . strtolower($name) . "' target='_blank'>$name</a>" : $name);
}
echo "</thead>\n";
}

View file

@ -106,7 +106,7 @@ if (!$error && $_POST) {
$id = "explain-$commands";
echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>\n";
echo "<div id='$id' class='hidden'>\n";
select($explain);
select($explain, $connection2, ($jush == "sql" ? "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/explain-output.html#" : ""));
echo "</div>\n";
}
}