1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

Allow specifying operator in search anywhere

This commit is contained in:
Jakub Vrana
2025-05-05 09:56:59 +02:00
parent 1862b84612
commit 307fabaf22
4 changed files with 4 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
## Adminer dev
- Allow specifying operator in search anywhere
## Adminer 5.3.0 (released 2025-05-04)
- Align numeric functions right

View File

@@ -64,12 +64,13 @@ if (adminer()->homepage()) {
echo "<form action='' method='post'>\n";
if (support("table")) {
echo "<fieldset><legend>" . lang('Search data in tables') . " <span id='selected2'></span></legend><div>";
echo "<input type='search' name='query' value='" . h($_POST["query"]) . "'>";
echo html_select("op", adminer()->operators(), idx($_POST, "op", JUSH == "elastic" ? "should" : "LIKE %%"));
echo " <input type='search' name='query' value='" . h($_POST["query"]) . "'>";
echo script("qsl('input').onkeydown = partialArg(bodyKeydown, 'search');", "");
echo " <input type='submit' name='search' value='" . lang('Search') . "'>\n";
echo "</div></fieldset>\n";
if ($_POST["search"] && $_POST["query"] != "") {
$_GET["where"][0]["op"] = driver()->convertOperator("LIKE %%");
$_GET["where"][0]["op"] = $_POST["op"];
search_tables();
}
}

View File

@@ -189,11 +189,6 @@ abstract class SqlDriver {
return $idf;
}
/** Convert operator so it can be used in search */
function convertOperator(string $operator): string {
return $operator;
}
/** Convert value returned by database to actual value
* @param Field $field
*/

View File

@@ -287,10 +287,6 @@ if (isset($_GET["elastic"])) {
return !!$this->conn->affected_rows;
}
function convertOperator($operator): string {
return $operator == "LIKE %%" ? "should" : $operator;
}
}
function support($feature) {