print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
?>
<p>
-<?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partitionByChange(this);"); ?>
+<?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partitionByChange(this);") . doc_link("partitioning-types.html"); ?>
(<input name="partition" value="<?php echo h($row["partition"]); ?>">)
<?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size<?php echo ($partition_table || !$row["partition_by"] ? " hidden" : ""); ?>" value="<?php echo h($row["partitions"]); ?>">
<table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
echo "</table>\n";
if (!information_schema(DB)) {
+ $analyze = "<input type='submit' value='" . lang('Analyze') . "'>";
+ $optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'>";
echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>"
- . (ereg('^(sql|sqlite|pgsql)$', $jush) ? ($jush != "sqlite" ? "<input type='submit' value='" . lang('Analyze') . "'> " : "") . "<input type='submit' name='optimize' value='" . lang('Optimize') . "'> " : "")
- . ($jush == "sql" ? "<input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "")
- . (support("table") ? "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . "> " : "")
- . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
+ . ($jush == "sqlite" ? $optimize . doc_command("vacuum") . " "
+ : ($jush == "pgsql" ? $analyze . doc_command("vacuum") . " $optimize" . doc_command("vacuum") . " "
+ : ($jush == "sql" ? $analyze . doc_command("analyze-table") . " $optimize" . doc_command("optimize-table") . " "
+ . "<input type='submit' name='check' value='" . lang('Check') . "'>" . doc_command("check-table") . " "
+ . "<input type='submit' name='repair' value='" . lang('Repair') . "'>" . doc_command("repair-table") . " "
+ : "")))
+ . (support("table") ? "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . ">" . doc_command($jush == "sqlite" ? "delete" : "truncate" . ($jush == "pgsql" ? "" : "-table")) . " " : "")
+ . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">" . doc_command("drop-table") . "\n";
$databases = (support("scheme") ? schemas() : $adminer->databases());
if (count($databases) != 1 && $jush != "sqlite") {
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
/** Print select result
* @param Min_Result
* @param Min_DB connection to examine indexes
-* @param string base link for <th> fields
* @param array
-* @return null
+* @return array $orgtables
*/
-function select($result, $connection2 = null, $href = "", $orgtables = array()) {
+function select($result, $connection2 = null, $orgtables = array()) {
+ global $jush;
$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
$orgtable = $field->orgtable;
$orgname = $field->orgname;
$return[$field->table] = $orgtable;
- if ($href) { // MySQL EXPLAIN
+ if ($orgtables && $jush == "sql") { // MySQL EXPLAIN
$links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null));
} elseif ($orgtable != "") {
if (!isset($indexes[$orgtable])) {
$blobs[$j] = true;
}
$types[$j] = $field->type;
- $name = h($name);
- echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">"
- . ($href ? "<a href='$href" . strtolower($name) . "' target='_blank' rel='noreferrer' class='help'>$name</a>" : $name)
+ echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
+ . ($orgtables && $jush == "sql" ? doc_link("explain-output.html#explain_" . strtolower($name)) : "")
;
}
echo "</thead>\n";
}
}
if (isset($links[$key]) && !$columns[$links[$key]]) {
- if ($href) { // MySQL EXPLAIN
+ if ($orgtables && $jush == "sql") { // MySQL EXPLAIN
$table = $row[array_search("table=", $links)];
$link = $links[$key] . urlencode($orgtables[$table] != "" ? $orgtables[$table] : $table);
} else {
}
return $val;
}
+
+/** Create link to database documentation
+* @param string
+* @return string HTML code
+*/
+function doc_link($path) {
+ global $jush, $connection;
+ $urls = array(
+ 'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/",
+ 'sqlite' => "http://www.sqlite.org/",
+ 'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/",
+ 'mssql' => "http://msdn.microsoft.com/library/",
+ 'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
+ );
+ return ($urls[$jush] ? "<a href='$urls[$jush]$path' target='_blank' rel='noreferrer'><sup>?</sup></a>" : "");
+}
+
+/** Create link to documentation of database command
+* @param string lower-case
+* @return string HTML code
+*/
+function doc_command($command) {
+ global $jush;
+ switch ($jush) {
+ case 'sql': return doc_link("$command.html");
+ case 'sqlite': return doc_link("lang_" . str_replace("-", "", $command) . ".html");
+ case 'pgsql': return doc_link("sql-" . str_replace("-", "", $command) . ".html");
+ case 'mssql':
+ $links = array(
+ 'drop-table' => 'ms173790',
+ 'truncate-table' => 'ms177570',
+ );
+ return doc_link("$links[$command].aspx");
+ case 'oracle':
+ $links = array(
+ 'drop-table' => 'statements_9003.htm',
+ 'truncate-table' => 'statements_10006.htm',
+ );
+ return doc_link($links[$command]);
+ }
+}
if (!$i) {
echo "<thead><tr lang='en'>" . (support("kill") ? "<th> " : "");
foreach ($row as $key => $val) {
- echo "<th>" . ($jush == "sql"
- ? "<a href='http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/show-processlist.html#processlist_" . strtolower($key) . "' target='_blank' rel='noreferrer' class='help'>$key</a>"
- : $key
- );
+ echo "<th>$key"
+ . ($jush == "sql" ? doc_link("show-processlist.html#processlist_" . strtolower($key)) : "")
+ ;
}
echo "</thead>\n";
}
$id = "explain-$commands";
echo ", <a href='#$id' onclick=\"return !toggle('$id');\">EXPLAIN</a>$export";
echo "<div id='$id' class='hidden'>\n";
- select($explain, $connection2, ($jush == "sql" ? "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/explain-output.html#explain_" : ""), $orgtables);
+ select($explain, $connection2, $orgtables);
echo "</div>\n";
} else {
echo $export;
<?php
//! MAX_* limits, REQUIRE
echo "<table cellspacing='0'>\n";
-echo "<thead><tr><th colspan='2'><a href='http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/grant.html#priv_level' target='_blank' rel='noreferrer' class='help'>" . lang('Privileges') . "</a>";
+echo "<thead><tr><th colspan='2'>" . lang('Privileges') . doc_link("grant.html#priv_level");
$i = 0;
foreach ($grants as $object => $grant) {
echo '<th>' . ($object != "*.*" ? "<input name='objects[$i]' value='" . h($object) . "' size='10' autocapitalize='off'>" : "<input type='hidden' name='objects[$i]' value='*.*' size='10'>*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
Add label to database selection
Add button for dropping an index
Display number of selected rows
+Add links to documentation
Disable underlining links
Improve speed of CSV import
Don't append newlines to uploaded files, bug since Adminer 3.7.0