Add more system tables help links

This commit is contained in:
Jakub Vrana 2018-02-08 11:21:33 +01:00
parent 8b8cfd9f04
commit cddd61c214
7 changed files with 44 additions and 3 deletions

View file

@ -314,6 +314,15 @@ if (!defined("DRIVER")) {
}
}
function tableHelp($name) {
if (information_schema(DB)) {
return strtolower(str_replace("_", "-", $name)) . "-table.html";
}
if (DB == "mysql") {
return "system-database.html"; //! more precise link
}
}
}

View file

@ -216,6 +216,17 @@ if (isset($_GET["pgsql"])) {
return $this->_conn->warnings();
}
function tableHelp($name) {
$links = array(
"information_schema" => "infoschema",
"pg_catalog" => "catalog",
);
$link = $links[$_GET["ns"]];
if ($link) {
return "$link-" . str_replace("_", "-", $name) . ".html";
}
}
}

View file

@ -218,6 +218,15 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values));
}
function tableHelp($name) {
if ($name == "sqlite_sequence") {
return "fileformat2.html#seqtab";
}
if ($name == "sqlite_master") {
return "fileformat2.html#$name";
}
}
}

View file

@ -160,6 +160,7 @@ class Adminer {
* @return null
*/
function selectLinks($tableStatus, $set = "") {
global $jush, $driver;
echo '<p class="links">';
$links = array("select" => lang('Select data'));
if (support("table") || support("indexes")) {
@ -175,9 +176,11 @@ class Adminer {
if ($set !== null) {
$links["edit"] = lang('New item');
}
$name = $tableStatus["Name"];
foreach ($links as $key => $val) {
echo " <a href='" . h(ME) . "$key=" . urlencode($tableStatus["Name"]) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
echo " <a href='" . h(ME) . "$key=" . urlencode($name) . ($key == "edit" ? $set : "") . "'" . bold(isset($_GET[$key])) . ">$val</a>";
}
echo doc_link(array($jush => $driver->tableHelp($name)), "?");
echo "\n";
}

View file

@ -147,4 +147,11 @@
return '';
}
/** Get help link for table
* @param string
* @return string relative URL or null
*/
function tableHelp($name) {
}
}

View file

@ -483,9 +483,10 @@ function ini_bytes($ini) {
/** Create link to database documentation
* @param array $jush => $path
* @param string HTML code
* @return string HTML code
*/
function doc_link($paths) {
function doc_link($paths, $text = "<sup>?</sup>") {
global $jush, $connection;
$version = preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $connection->server_info);
$urls = array(
@ -495,7 +496,7 @@ function doc_link($paths) {
'mssql' => "https://msdn.microsoft.com/library/",
'oracle' => "https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
);
return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . "><sup>?</sup></a>" : "");
return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . ">$text</a>" : "");
}
/** Wrap gzencode() for usage in ob_start()

View file

@ -1,6 +1,7 @@
Adminer 4.6.1-dev:
Speed up rendering of long tables (regression from 4.4.0)
Sticky position of table actions
Add system tables help links
MySQL: Support non-utf8 charset in search in column
MySQL: Support geometry in MySQL 8 (bug #574)
SQLite: Allow deleting PRIMARY KEY from tables with auto increment