diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index a058de92..9964448e 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -18,9 +18,12 @@ function select($result, $connection2 = null, $href = "") { echo ""; for ($j=0; $j < count($row); $j++) { $field = $result->fetch_field(); + $name = $field->name; $orgtable = $field->orgtable; $orgname = $field->orgname; - if ($orgtable != "") { + if ($href) { // MySQL EXPLAIN + $links[$j] = ($name == "table" ? "table=" : ($name == "possible_keys" ? "indexes=" : null)); + } elseif ($orgtable != "") { if (!isset($indexes[$orgtable])) { // find primary key in each table $indexes[$orgtable] = array(); @@ -42,7 +45,7 @@ function select($result, $connection2 = null, $href = "") { $blobs[$j] = true; } $types[$j] = $field->type; - $name = h($field->name); + $name = h($name); echo "name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . ($href ? "$name" : $name); } echo "\n"; @@ -51,24 +54,26 @@ function select($result, $connection2 = null, $href = "") { foreach ($row as $key => $val) { if (!isset($val)) { $val = "NULL"; + } elseif ($blobs[$key] && !is_utf8($val)) { + $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download + } elseif (!strlen($val)) { // strlen - SQLite can return int + $val = " "; // some content to print a border } else { - if ($blobs[$key] && !is_utf8($val)) { - $val = "" . lang('%d byte(s)', strlen($val)) . ""; //! link to download - } elseif (!strlen($val)) { // strlen - SQLite can return int - $val = " "; // some content to print a border - } else { - $val = h($val); - if ($types[$key] == 254) { // 254 - char - $val = "$val"; - } + $val = h($val); + if ($types[$key] == 254) { // 254 - char + $val = "$val"; } - if (isset($links[$key]) && !$columns[$links[$key]]) { + } + if (isset($links[$key]) && !$columns[$links[$key]]) { + if ($href) { // MySQL EXPLAIN + $link = $links[$key] . urlencode($row[array_search("table=", $links)]); + } else { $link = "edit=" . urlencode($links[$key]); foreach ($indexes[$links[$key]] as $col => $j) { $link .= "&where" . urlencode("[" . bracket_escape($col) . "]") . "=" . urlencode($row[$j]); } - $val = "$val"; } + $val = "$val"; } echo "$val"; } diff --git a/changes.txt b/changes.txt index 486d2374..cf6464a0 100644 --- a/changes.txt +++ b/changes.txt @@ -11,6 +11,7 @@ Display column collation in tooltip Keyboard shortcuts: Alt+Shift+1 for homepage, Ctrl+Shift+Enter for Save and continue edit Show only errors with Webserver file SQL command Remember select export and import options +Link tables and indexes from SQL command EXPLAIN (MySQL) Display error with all wrong SQL commands (MySQL) Display foreign keys from other schemas (PostgreSQL) Pagination support (Oracle)