From 0782a7b2c11d8b04757e301195e711fdfb4b2c82 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sun, 17 Oct 2010 22:37:06 +0200 Subject: [PATCH] Save '' instead of NULL for empty char (some drivers don't have varchar) --- adminer/select.inc.php | 2 +- editor/include/adminer.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 191701a6..21e8ef48 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -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) . " = " . (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) { diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 8014e74c..7e80c937 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -415,7 +415,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 = 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)";