Skip to content

Commit 7defb77

Browse files
committed
Editor: Allow disabling boolean fields in PostgreSQL (bug #640)
1 parent 659003e commit 7defb77

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Display the tables scrollbar (bug #647)
33
Add autocomplete attributes to login form
44
PHP <5.4 compatibility even with ClickHouse enabled (regression from 4.7.0)
55
SQLite: Hide server field in login form
6+
Editor: Allow disabling boolean fields in PostgreSQL (bug #640)
67

78
Adminer 4.7.0 (released 2018-11-24):
89
Simplify storing executed SQL queries to bookmarks

editor/include/adminer.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ function editInput($table, $field, $attrs, $value) {
485485
);
486486
}
487487
if (like_bool($field)) {
488-
return '<input type="checkbox" value="' . h($value ? $value : 1) . '"' . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? ' checked' : '') . "$attrs>";
488+
return '<input type="checkbox" value="1"' . (preg_match('~^(1|t|true|y|yes|on)$~i', $value) ? ' checked' : '') . "$attrs>";
489489
}
490490
$hint = "";
491491
if (preg_match('~time~', $field["type"])) {
@@ -517,7 +517,7 @@ function processInput($field, $value, $function = "") {
517517
}
518518
$return = ($field["type"] == "bit" && preg_match('~^[0-9]+$~', $value) ? $return : q($return));
519519
if ($value == "" && like_bool($field)) {
520-
$return = "0";
520+
$return = "'0'";
521521
} elseif ($value == "" && ($field["null"] || !preg_match('~char|text~', $field["type"]))) {
522522
$return = "NULL";
523523
} elseif (preg_match('~^(md5|sha1)$~', $function)) {

0 commit comments

Comments
 (0)