"
- . (ereg('^(sql|sqlite|pgsql)$', $jush) ? ($jush != "sqlite" ? "
" : "") . "
" : "")
- . ($jush == "sql" ? "
" : "")
- . (support("table") ? "
" : "")
- . "
\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") . " "
+ . "
" . doc_command("check-table") . " "
+ . "
" . doc_command("repair-table") . " "
+ : "")))
+ . (support("table") ? "
" . doc_command($jush == "sqlite" ? "delete" : "truncate" . ($jush == "pgsql" ? "" : "-table")) . " " : "")
+ . "
" . 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));
diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php
index aa6d8d02..af2c445a 100644
--- a/adminer/include/editing.inc.php
+++ b/adminer/include/editing.inc.php
@@ -2,11 +2,11 @@
/** Print select result
* @param Min_Result
* @param Min_DB connection to examine indexes
-* @param string base link for
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
@@ -24,7 +24,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
$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])) {
@@ -48,9 +48,8 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
$blobs[$j] = true;
}
$types[$j] = $field->type;
- $name = h($name);
- echo " | name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">"
- . ($href ? "$name" : $name)
+ echo " | name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
+ . ($orgtables && $jush == "sql" ? doc_link("explain-output.html#explain_" . strtolower($name)) : "")
;
}
echo "\n";
@@ -70,7 +69,7 @@ function select($result, $connection2 = null, $href = "", $orgtables = array())
}
}
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 {
@@ -450,3 +449,44 @@ function ini_bytes($ini) {
}
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] ? "?" : "");
+}
+
+/** 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]);
+ }
+}
diff --git a/adminer/processlist.inc.php b/adminer/processlist.inc.php
index b7c3e6a8..5d8cb84b 100644
--- a/adminer/processlist.inc.php
+++ b/adminer/processlist.inc.php
@@ -22,10 +22,9 @@ foreach (process_list() as $i => $row) {
if (!$i) {
echo "" . (support("kill") ? " " : "");
foreach ($row as $key => $val) {
- echo " | " . ($jush == "sql"
- ? "$key"
- : $key
- );
+ echo " | $key"
+ . ($jush == "sql" ? doc_link("show-processlist.html#processlist_" . strtolower($key)) : "")
+ ;
}
echo " | \n";
}
diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php
index 1fa96e17..b434e84f 100644
--- a/adminer/sql.inc.php
+++ b/adminer/sql.inc.php
@@ -136,7 +136,7 @@ if (!$error && $_POST) {
$id = "explain-$commands";
echo ", EXPLAIN$export";
echo "\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 " \n";
} else {
echo $export;
diff --git a/adminer/user.inc.php b/adminer/user.inc.php
index 71e7cf6a..986e8c0c 100644
--- a/adminer/user.inc.php
+++ b/adminer/user.inc.php
@@ -142,7 +142,7 @@ if ($_POST) {
\n";
-echo "" . lang('Privileges') . "";
+echo "" . lang('Privileges') . doc_link("grant.html#priv_level");
$i = 0;
foreach ($grants as $object => $grant) {
echo ' | ' . ($object != "*.*" ? "" : "*.*"); //! separate db, table, columns, PROCEDURE|FUNCTION, routine
diff --git a/changes.txt b/changes.txt
index f0266013..456426db 100644
--- a/changes.txt
+++ b/changes.txt
@@ -6,6 +6,7 @@ Mark length as required for strings
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
|
---|
|
---|
|