]> git.joonet.de Git - adminer.git/commitdiff
Save NULL for empty string in inline-edit
authorJakub Vrana <jakub@vrana.cz>
Sun, 17 Oct 2010 14:37:22 +0000 (16:37 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sun, 17 Oct 2010 14:37:22 +0000 (16:37 +0200)
adminer/select.inc.php

index c541d83780cf0d4993e4b05fadf506fb42d9c0e5..191701a60f6b47abadd6095b56f961461c8d2263 100644 (file)
@@ -126,7 +126,7 @@ if ($_POST && !$error) {
                                        $set = array();
                                        foreach ($row as $key => $val) {
                                                $key = bracket_escape($key, 1); // 1 - back
-                                               $set[] = idf_escape($key) . " = " . $adminer->processInput($fields[$key], $val);
+                                               $set[] = idf_escape($key) . " = " . (ereg('varchar|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL");
                                        }
                                        $result = queries("UPDATE" . limit1(table($TABLE) . " SET " . implode(", ", $set), " WHERE " . where_check($unique_idf) . ($where ? " AND " . implode(" AND ", $where) : ""))); // can change row on a different page without unique key
                                        if (!$result) {