1
0
mirror of https://github.com/vrana/adminer.git synced 2025-09-08 21:30:42 +02:00

Enable regular expressions when searching data in all tables

Allows use of the database-specific regex operator and pattern syntax when searching multiple tables.
This commit is contained in:
Roy-Orbison
2023-05-22 04:47:33 +02:00
committed by Peter Knut
parent 9ed4c859ed
commit 6f789eac0a
7 changed files with 25 additions and 10 deletions

View File

@@ -59,9 +59,13 @@ if ($adminer->homepage()) {
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";
if ($adminer->operator_regexp !== null) {
echo "<p><label><input type='checkbox' name='regexp' value='1'" . (empty($_POST['regexp']) ? '' : ' checked') . '>' . lang('as a regular expression') . '</label>';
echo doc_link(['sql' => 'regexp.html', 'pgsql' => 'functions-matching.html#FUNCTIONS-POSIX-REGEXP']) . "</p>\n";
}
echo "</div></fieldset>\n";
if ($_POST["search"] && $_POST["query"] != "") {
$_GET["where"][0]["op"] = $driver->convertOperator("LIKE %%");
$_GET["where"][0]["op"] = $driver->convertOperator($adminer->operator_regexp !== null && !empty($_POST['regexp']) ? $adminer->operator_regexp : "LIKE %%");
search_tables();
}
}