diff --git a/js/makegrid.js b/js/makegrid.js
index be08354237..f5bb9012fa 100644
--- a/js/makegrid.js
+++ b/js/makegrid.js
@@ -27,6 +27,7 @@
inEditMode: false, // true if grid is in edit mode
cellEditHint: '', // hint shown when doing grid edit
gotoLinkText: 'Go to link', // "Go to link" text
+ wasEditedCellNull: false, // true if last value of the edited cell was NULL
// functions
dragStartRsz: function(e, obj) { // start column resize
@@ -622,6 +623,7 @@
$editArea.append(gotoLink);
}
+ g.wasEditedCellNull = false;
if ($td.is(':not(.not_null)')) {
// append a null checkbox
$editArea.append('
Null :
');
@@ -629,6 +631,7 @@
// check if current is NULL
if ($td.is('.null')) {
$checkbox.attr('checked', true);
+ g.wasEditedCellNull = true;
}
// if the select/editor is changed un-check the 'checkbox_null__'.
@@ -877,8 +880,10 @@
var addQuotes = true;
if (is_null) {
- sql_query += ' `' + field_name + "`=NULL , ";
- need_to_post = true;
+ if (!g.wasEditedCellNull) {
+ sql_query += ' `' + field_name + "`=NULL , ";
+ need_to_post = true;
+ }
} else {
if($this_field.is(":not(.relation, .enum, .set, .bit)")) {
this_field_params[field_name] = $(g.cEdit).find('textarea').val();
@@ -913,7 +918,8 @@
if (where_clause.indexOf(field_name) > -1) {
new_clause += '`' + window.parent.table + '`.' + '`' + field_name + "` = '" + this_field_params[field_name].replace(/'/g,"''") + "'" + ' AND ';
}
- if (this_field_params[field_name] != PMA_getCellValue(g.currentEditCell)) {
+ if (g.wasEditedCellNull || this_field_params[field_name] != PMA_getCellValue(g.currentEditCell))
+ {
if (addQuotes == true) {
sql_query += ' `' + field_name + "`='" + this_field_params[field_name].replace(/'/g, "''") + "', ";
} else {
|