Browse files

Prefer NULL to empty string in foreign keys (bug #3323800)

  • Loading branch information...
1 parent d9c2e80 commit f8ae1d6360c909a7bac244c600a19ea537587b2c @vrana committed Jun 23, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 editor/include/adminer.inc.php
View
2 editor/include/adminer.inc.php
@@ -465,7 +465,7 @@ function processInput($field, $value, $function = "") {
$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)";

0 comments on commit f8ae1d6

Please sign in to comment.