Permalink
Browse files

Save '' instead of NULL for empty char (some drivers don't have varchar)

  • Loading branch information...
vrana committed Oct 17, 2010
1 parent 9db4259 commit 0782a7b2c11d8b04757e301195e711fdfb4b2c82
Showing with 2 additions and 2 deletions.
  1. +1 −1 adminer/select.inc.php
  2. +1 −1 editor/include/adminer.inc.php
View
@@ -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) {
@@ -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)";

0 comments on commit 0782a7b

Please sign in to comment.