MariaDB: Links to documentation

This commit is contained in:
Jakub Vrana 2018-02-08 13:56:22 +01:00
parent f0b7d8ccd0
commit 76d7560d27
6 changed files with 19 additions and 6 deletions

View file

@ -63,6 +63,7 @@ echo ($_POST["add_x"] || strpos($name, "\n")
: '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">' : '<input name="name" id="name" value="' . h($name) . '" maxlength="64" autocapitalize="off">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array( ) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array(
'sql' => "charset-charsets.html", 'sql' => "charset-charsets.html",
'mariadb' => "supported-character-sets-and-collations/",
'mssql' => "ms187963.aspx", 'mssql' => "ms187963.aspx",
)) : ""); )) : "");
echo script("focus(qs('#name'));"); echo script("focus(qs('#name'));");

View file

@ -72,11 +72,11 @@ if ($adminer->homepage()) {
echo '<td><input id="check-all" type="checkbox" class="jsonly">' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); echo '<td><input id="check-all" type="checkbox" class="jsonly">' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", "");
echo '<th>' . lang('Table'); echo '<th>' . lang('Table');
echo '<td>' . lang('Engine') . doc_link(array('sql' => 'storage-engines.html')); echo '<td>' . lang('Engine') . doc_link(array('sql' => 'storage-engines.html'));
echo '<td>' . lang('Collation') . doc_link(array('sql' => 'charset-mysql.html')); echo '<td>' . lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/'));
echo '<td>' . lang('Data Length') . $doc_link; echo '<td>' . lang('Data Length') . $doc_link;
echo '<td>' . lang('Index Length') . $doc_link; echo '<td>' . lang('Index Length') . $doc_link;
echo '<td>' . lang('Data Free') . $doc_link; echo '<td>' . lang('Data Free') . $doc_link;
echo '<td>' . lang('Auto Increment') . doc_link(array('sql' => 'example-auto-increment.html')); echo '<td>' . lang('Auto Increment') . doc_link(array('sql' => 'example-auto-increment.html', 'mariadb' => 'auto_increment/'));
echo '<td>' . lang('Rows') . $doc_link; echo '<td>' . lang('Rows') . $doc_link;
echo (support("comment") ? '<td>' . lang('Comment') . $doc_link : ''); echo (support("comment") ? '<td>' . lang('Comment') . $doc_link : '');
echo "</thead>\n"; echo "</thead>\n";

View file

@ -315,11 +315,12 @@ if (!defined("DRIVER")) {
} }
function tableHelp($name) { function tableHelp($name) {
$maria = preg_match('~MariaDB~', $this->_conn->server_info);
if (information_schema(DB)) { if (information_schema(DB)) {
return strtolower(str_replace("_", "-", $name)) . "-table.html"; return strtolower(($maria ? "information-schema-$name-table/" : str_replace("_", "-", $name) . "-table.html"));
} }
if (DB == "mysql") { if (DB == "mysql") {
return "system-database.html"; //! more precise link return ($maria ? "mysql$name-table/" : "system-database.html"); //! more precise link
} }
} }

View file

@ -78,6 +78,7 @@ foreach ($row["source"] as $key => $val) {
<?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]); ?> <?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + explode("|", $on_actions), $row["on_update"]); ?>
<?php echo doc_link(array( <?php echo doc_link(array(
'sql' => "innodb-foreign-key-constraints.html", 'sql' => "innodb-foreign-key-constraints.html",
'mariadb' => "foreign-keys/",
'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES", 'pgsql' => "sql-createtable.html#SQL-CREATETABLE-REFERENCES",
'mssql' => "ms174979.aspx", 'mssql' => "ms174979.aspx",
'oracle' => "clauses002.htm#sthref2903", 'oracle' => "clauses002.htm#sthref2903",

View file

@ -50,7 +50,10 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
} }
$types[$j] = $field->type; $types[$j] = $field->type;
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name) echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
. ($orgtables ? doc_link(array('sql' => "explain-output.html#explain_" . strtolower($name))) : "") . ($orgtables ? doc_link(array(
'sql' => "explain-output.html#explain_" . strtolower($name),
'mariadb' => "explain/#the-columns-in-explain-select",
)) : "")
; ;
} }
echo "</thead>\n"; echo "</thead>\n";
@ -244,6 +247,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
<td id="label-null">NULL <td id="label-null">NULL
<td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="<?php echo lang('Auto Increment'); ?>">AI</acronym><?php echo doc_link(array( <td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="<?php echo lang('Auto Increment'); ?>">AI</acronym><?php echo doc_link(array(
'sql' => "example-auto-increment.html", 'sql' => "example-auto-increment.html",
'mariadb' => "auto_increment/",
'sqlite' => "autoinc.html", 'sqlite' => "autoinc.html",
'pgsql' => "datatype.html#DATATYPE-SERIAL", 'pgsql' => "datatype.html#DATATYPE-SERIAL",
'mssql' => "ms186775.aspx", 'mssql' => "ms186775.aspx",
@ -488,7 +492,8 @@ function ini_bytes($ini) {
*/ */
function doc_link($paths, $text = "<sup>?</sup>") { function doc_link($paths, $text = "<sup>?</sup>") {
global $jush, $connection; global $jush, $connection;
$version = preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $connection->server_info); $server_info = $connection->server_info;
$version = preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $server_info); // two most significant digits
$urls = array( $urls = array(
'sql' => "https://dev.mysql.com/doc/refman/$version/en/", 'sql' => "https://dev.mysql.com/doc/refman/$version/en/",
'sqlite' => "https://www.sqlite.org/", 'sqlite' => "https://www.sqlite.org/",
@ -496,6 +501,10 @@ function doc_link($paths, $text = "<sup>?</sup>") {
'mssql' => "https://msdn.microsoft.com/library/", 'mssql' => "https://msdn.microsoft.com/library/",
'oracle' => "https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/", 'oracle' => "https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
); );
if (preg_match('~MariaDB~', $server_info)) {
$urls['sql'] = "https://mariadb.com/kb/en/library/";
$paths['sql'] = (isset($paths['mariadb']) ? $paths['mariadb'] : str_replace(".html", "/", $paths['sql']));
}
return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . ">$text</a>" : ""); return ($paths[$jush] ? "<a href='$urls[$jush]$paths[$jush]'" . target_blank() . ">$text</a>" : "");
} }

View file

@ -4,6 +4,7 @@ Sticky position of table actions
Add system tables help links Add system tables help links
MySQL: Support non-utf8 charset in search in column MySQL: Support non-utf8 charset in search in column
MySQL: Support geometry in MySQL 8 (bug #574) MySQL: Support geometry in MySQL 8 (bug #574)
MariaDB: Links to documentation
SQLite: Allow deleting PRIMARY KEY from tables with auto increment SQLite: Allow deleting PRIMARY KEY from tables with auto increment
PostgreSQL: Support binary files in bytea fields PostgreSQL: Support binary files in bytea fields
PostgreSQL: Don't treat interval type as number (bug #474) PostgreSQL: Don't treat interval type as number (bug #474)