In Elasticsearch, text fields are not sortable.
"select" => 1,
"update" => 1,
"where" => 1,
+ "order" => 1,
),
);
}
"null" => $row["is_nullable"],
"auto_increment" => $row["is_identity"],
"collation" => $row["collation_name"],
- "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1),
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1, "order" => 1),
"primary" => $row["is_primary_key"],
"comment" => $comments[$row["name"]],
);
"auto_increment" => ($extra == "auto_increment"),
"on_update" => (preg_match('~\bon update (\w+)~i', $extra, $match) ? $match[1] : ""), //! available since MySQL 5.1.23
"collation" => $row["COLLATION_NAME"],
- "privileges" => array_flip(explode(",", "$row[PRIVILEGES],where")),
+ "privileges" => array_flip(explode(",", "$row[PRIVILEGES],where,order")),
"comment" => $row["COLUMN_COMMENT"],
"primary" => ($row["COLUMN_KEY"] == "PRI"),
"generated" => ($generated[1] == "PERSISTENT" ? "STORED" : $generated[1]),
"null" => ($row["NULLABLE"] == "Y"),
//! "auto_increment" => false,
//! "collation" => $row["CHARACTER_SET_NAME"],
- "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1),
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1, "order" => 1),
//! "comment" => $row["Comment"],
//! "primary" => ($row["Key"] == "PRI"),
);
"full_type" => $type,
"default" => (preg_match("~^'(.*)'$~", $default, $match) ? str_replace("''", "'", $match[1]) : ($default == "NULL" ? null : $default)),
"null" => !$row["notnull"],
- "privileges" => array("select" => 1, "insert" => 1, "update" => 1, "where" => 1),
+ "privileges" => array("select" => 1, "insert" => 1, "update" => 1, "where" => 1, "order" => 1),
"primary" => $row["pk"],
);
if ($row["pk"]) {
$name = bracket_escape($key, 1); // 1 - back
$return[$name] = array(
"field" => $name,
- "privileges" => array("insert" => 1, "update" => 1, "where" => 1),
+ "privileges" => array("insert" => 1, "update" => 1, "where" => 1, "order" => 1),
"null" => 1,
"auto_increment" => ($key == $driver->primary),
);
$rights = array(); // privilege => 0
$columns = array(); // selectable columns
$search_columns = array(); // searchable columns
+$order_columns = array(); // searchable columns
$text_length = null;
foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field);
if (isset($field["privileges"]["where"]) && $name != "") {
$search_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
}
+ if (isset($field["privileges"]["order"]) && $name != "") {
+ $order_columns[$key] = html_entity_decode(strip_tags($name), ENT_QUOTES);
+ }
$rights += $field["privileges"];
}
echo "</div>\n";
$adminer->selectColumnsPrint($select, $columns);
$adminer->selectSearchPrint($where, $search_columns, $indexes);
- $adminer->selectOrderPrint($order, $columns, $indexes);
+ $adminer->selectOrderPrint($order, $order_columns, $indexes);
$adminer->selectLimitPrint($limit);
$adminer->selectLengthPrint($text_length);
$adminer->selectActionPrint($indexes);
$column = idf_escape($key);
$href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key);
$desc = "&desc%5B0%5D=1";
+ $sortable = isset($field["privileges"]["order"]);
echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", "");
- echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">'; // $order[0] == $key - COUNT(*)
- echo apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
+ if ($sortable) {
+ echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">'; // $order[0] == $key - COUNT(*)
+ }
+ echo apply_sql_function($val["fun"], $name); //! columns looking like functions
+ if ($sortable) {
+ echo "</a>";
+ }
echo "<span class='column hidden'>";
- echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
+ if ($sortable) {
+ echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
+ }
if (!$val["fun"] && isset($field["privileges"]["where"])) {
echo '<a href="#fieldset-search" title="' . lang('Search') . '" class="text jsonly"> =</a>';
echo script("qsl('a').onclick = partial(selectSearch, '" . js_escape($key) . "');");
Adminer dev:
PostgreSQL: Fix setting NULL and original value on enum (bug #884)
CockroachDB: Add support via PostgreSQL driver
-Elasticsearch: Add support for "where" field privilege
+Elasticsearch: Add support for "where" and "order" field privilege
Adminer 5.0.1 (released 2025-03-07):
Fix bulk operations with tables (regression from 5.0.0)
"default" => trim($row['default_expression']),
"null" => $nullable,
"auto_increment" => '0',
- "privileges" => array("insert" => 1, "select" => 1, "update" => 0, "where" => 1),
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 0, "where" => 1, "order" => 1),
);
}
"null" => (trim($row["FIELD_NOT_NULL_CONSTRAINT"]) == "YES"),
"auto_increment" => '0',
"collation" => trim($row["FIELD_COLLATION"]),
- "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1),
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 1, "where" => 1, "order" => 1),
"comment" => trim($row["FIELD_DESCRIPTION"]),
);
}
https://github.com/vrana/adminer/compare/master...adminneo-org:adminneo:main
Add drag-n-drop moving of rows in table editing
-Elasticsearch: Add support for "order" field privilege
Elasticsearch: New condition operators as the combination of query type and match type
Editor: