1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 11:34:10 +02:00

Split editFunctions

This commit is contained in:
Jakub Vrana
2025-03-28 14:53:53 +01:00
parent 46f6a96c95
commit 195341d075
11 changed files with 40 additions and 48 deletions

View File

@@ -672,7 +672,7 @@ class Adminer {
global $driver;
$return = ($field["null"] ? "NULL/" : "");
$update = isset($_GET["select"]) || where($_GET);
foreach ($driver->editFunctions as $key => $functions) {
foreach (array($driver->insertFunctions, $driver->editFunctions) as $key => $functions) {
if (!$key || (!isset($_GET["call"]) && $update)) { // relative functions
foreach ($functions as $pattern => $val) {
if (!$pattern || preg_match("~$pattern~", $field["type"])) {
@@ -680,7 +680,7 @@ class Adminer {
}
}
}
if ($key && !preg_match('~set|blob|bytea|raw|file|bool~', $field["type"])) {
if ($key && $functions && !preg_match('~set|blob|bytea|raw|file|bool~', $field["type"])) {
$return .= "/SQL";
}
}

View File

@@ -21,7 +21,8 @@ abstract class SqlDriver {
protected Db $conn;
/** @var int[][] */ protected array $types = array(); // [$group => [$type => $maximum_unsigned_length, ...], ...]
/** @var array{0?:string[], 1?:string[]} */ public array $editFunctions = array(); // of ["$type|$type2" => "$function/$function2"] functions used in editing, [0] - edit and insert, [1] - edit only
/** @var string[] */ public array $insertFunctions = array(); // ["$type|$type2" => "$function/$function2"] functions used in edit and insert
/** @var string[] */ public array $editFunctions = array(); // ["$type|$type2" => "$function/$function2"] functions used in edit only
/** @var list<string> */ public array $unsigned = array(); // number variants
/** @var list<string> */ public array $operators = array(); // operators used in select
/** @var list<string> */ public array $functions = array(); // functions used in select

View File

@@ -191,7 +191,7 @@ function enum_input(string $type, string $attrs, array $field, $value, string $e
* @param Field|RoutineField $field
* @param mixed $value
*/
function input(array $field, $value, string $function, ?bool $autofocus = false): void {
function input(array $field, $value, ?string $function, ?bool $autofocus = false): void {
global $driver, $adminer;
$name = h(bracket_escape($field["field"]));
echo "<td class='function'>";