Skip to content

Commit

Permalink
Save '' instead of NULL for empty char (some drivers don't have varchar)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Oct 17, 2010
1 parent 9db4259 commit 0782a7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adminer/select.inc.php
Expand Up @@ -126,7 +126,7 @@
$set = array();
foreach ($row as $key => $val) {
$key = bracket_escape($key, 1); // 1 - back
$set[] = idf_escape($key) . " = " . (ereg('varchar|text', $fields[$key]["type"]) || $val != "" ? $adminer->processInput($fields[$key], $val) : "NULL");
$set[] = idf_escape($key) . " = " . (ereg('char|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) {
Expand Down
2 changes: 1 addition & 1 deletion editor/include/adminer.inc.php
Expand Up @@ -415,7 +415,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 = q($return);
if (!ereg('varchar|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") {
if (!ereg('char|text', $field["type"]) && $field["full_type"] != "tinyint(1)" && $value == "") {
$return = "NULL";
} elseif (ereg('^(md5|sha1)$', $function)) {
$return = "$function($return)";
Expand Down

0 comments on commit 0782a7b

Please sign in to comment.