Editor: Allow disabling boolean fields in PostgreSQL (bug #640)

This commit is contained in:
Jakub Vrana 2019-01-22 12:04:08 +01:00
parent 659003e07f
commit 7defb7787d
2 changed files with 3 additions and 2 deletions

View file

@ -3,6 +3,7 @@ Display the tables scrollbar (bug #647)
Add autocomplete attributes to login form
PHP <5.4 compatibility even with ClickHouse enabled (regression from 4.7.0)
SQLite: Hide server field in login form
Editor: Allow disabling boolean fields in PostgreSQL (bug #640)
Adminer 4.7.0 (released 2018-11-24):
Simplify storing executed SQL queries to bookmarks

View file

@ -485,7 +485,7 @@ qsl('div').onclick = whisperClick;", "")
);
}
if (like_bool($field)) {
return '<input type="checkbox" value="' . h($value ? $value : 1) . '"' . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? ' checked' : '') . "$attrs>";
return '<input type="checkbox" value="1"' . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? ' checked' : '') . "$attrs>";
}
$hint = "";
if (preg_match('~time~', $field["type"])) {
@ -517,7 +517,7 @@ qsl('div').onclick = whisperClick;", "")
}
$return = ($field["type"] == "bit" && preg_match('~^[0-9]+$~', $value) ? $return : q($return));
if ($value == "" && like_bool($field)) {
$return = "0";
$return = "'0'";
} elseif ($value == "" && ($field["null"] || !preg_match('~char|text~', $field["type"]))) {
$return = "NULL";
} elseif (preg_match('~^(md5|sha1)$~', $function)) {