Bug #3184827 Inline edit fails on some tables

This commit is contained in:
Madhura Jayaratne
2011-02-18 07:35:12 +05:30
parent 82a1d451d1
commit 2a754b25e4

View File

@@ -643,12 +643,16 @@ $(document).ready(function() {
*/ */
var sql_query = 'UPDATE ' + window.parent.table + ' SET '; var sql_query = 'UPDATE ' + window.parent.table + ' SET ';
$.each(params_to_submit, function(key, value) { // $.each() not used here since it cause problems when there is a column
if(value.length == 0) { // in the table with the name 'length'. See bug #3184827
value = 'NULL' var value;
for (var key in params_to_submit) {
value = params_to_submit[key];
if (value.length == 0) {
value = 'NULL';
} }
sql_query += ' ' + key + "='" + value.replace(/'/g, "''") + "' , "; sql_query += ' ' + key + "='" + value.replace(/'/g, "''") + "' , ";
}) }
//Remove the last ',' appended in the above loop //Remove the last ',' appended in the above loop
sql_query = sql_query.replace(/,\s$/, ''); sql_query = sql_query.replace(/,\s$/, '');
sql_query += ' WHERE ' + PMA_urldecode(where_clause); sql_query += ' WHERE ' + PMA_urldecode(where_clause);