]> git.joonet.de Git - adminer.git/commitdiff
Prefer NULL to empty string in foreign keys (bug #3323800)
authorJakub Vrana <jakub@vrana.cz>
Thu, 23 Jun 2011 19:21:53 +0000 (21:21 +0200)
committerJakub Vrana <jakub@vrana.cz>
Thu, 23 Jun 2011 20:11:08 +0000 (22:11 +0200)
editor/include/adminer.inc.php

index a88b53cf2ecc8cc920d1f03bfdb9e02c86e482f1..58821b0a2b6984545c403b19e4212a8e2c99f964 100644 (file)
@@ -465,7 +465,7 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                        $return = ($match["p1"] != "" ? $match["p1"] : ($match["p2"] != "" ? ($match["p2"] < 70 ? 20 : 19) . $match["p2"] : gmdate("Y"))) . "-$match[p3]$match[p4]-$match[p5]$match[p6]" . end($match);
                }
                $return = ($field["type"] == "bit" && ereg('^[0-9]+$', $value) ? $return : q($return));
-               if (!ereg('char|text', $field["type"]) && !like_bool($field) && $value == "") {
+               if ($value == "" && ($field["null"] || !ereg('char|text', $field["type"])) && !like_bool($field)) {
                        $return = "NULL";
                } elseif (ereg('^(md5|sha1)$', $function)) {
                        $return = "$function($return)";