]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Don't offer empty enum value in edit
authorJakub Vrana <jakub@vrana.cz>
Sun, 23 Feb 2025 12:17:08 +0000 (13:17 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sun, 23 Feb 2025 12:24:30 +0000 (13:24 +0100)
MySQL errors if there's an invalid value on the first row of INSERT or
UPDATE, regardless of the sql_mode variable.

adminer/include/adminer.inc.php
changes.txt
todo.txt

index ec3260aa4846002bbd0bc6cca992e621ca9ee190..33ddef293bb73ee64a5b4932e5bac84a34f91cde 100644 (file)
@@ -710,7 +710,7 @@ class Adminer {
                if ($field["type"] == "enum") {
                        return (isset($_GET["select"]) ? "<label><input type='radio'$attrs value='-1' checked><i>" . lang('original') . "</i></label> " : "")
                                . ($field["null"] ? "<label><input type='radio'$attrs value=''" . ($value !== null || isset($_GET["select"]) ? "" : " checked") . "><i>NULL</i></label> " : "")
-                               . enum_input("radio", $attrs, $field, $value, 0) // 0 - empty
+                               . enum_input("radio", $attrs, $field, $value, $value === 0 ? 0 : null) // 0 - empty value
                        ;
                }
                return "";
index a52d8d162472e94bac34020a607a60941d83ff51..a4f76d67166e08c40eae90388f6f7262f9a7b6e9 100644 (file)
@@ -1,6 +1,7 @@
 Adminer 4.17.0-dev:
 Hide index column options by default
 MySQL, PostgreSQL, MS SQL: Support CHECK constraint
+MySQL: Don't offer empty enum value in edit
 PostgreSQL: Link user defined types
 PostgreSQL: Constraint enum values in editing (bug #270)
 SQLite: Show all supported pragmas in Variables
index 87332ba078abea255ac5808f53525ea122c10cd5..19b6b215b12b393f59282a6de058d2fb8100365d 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -14,7 +14,6 @@ Skinnable plus.gif and other images - http://typo3.org/extensions/repository/vie
 ? Branch binary_compile: LZW compression of all texts can save 11 KB, using chars 127-255 in minification can save 1 KB
 
 https://github.com/vrana/adminer/compare/master...adminneo-org:adminneo:main
-MySQL: Do not show 'empty' enum value in strict mode
 MySQL: Print comments of stored procedures and functions
 Add drag-n-drop moving of rows in table editing
 PostgreSQL: Show list of schemas in database