From 2a754b25e44212a9d3cca035f29c86705ac8c2da Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Fri, 18 Feb 2011 07:35:12 +0530 Subject: [PATCH] Bug #3184827 Inline edit fails on some tables --- js/sql.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/js/sql.js b/js/sql.js index d28634802..fd3884340 100644 --- a/js/sql.js +++ b/js/sql.js @@ -643,12 +643,16 @@ $(document).ready(function() { */ var sql_query = 'UPDATE ' + window.parent.table + ' SET '; - $.each(params_to_submit, function(key, value) { - if(value.length == 0) { - value = 'NULL' - } - sql_query += ' ' + key + "='" + value.replace(/'/g, "''") + "' , "; - }) + // $.each() not used here since it cause problems when there is a column + // in the table with the name 'length'. See bug #3184827 + 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, "''") + "' , "; + } //Remove the last ',' appended in the above loop sql_query = sql_query.replace(/,\s$/, ''); sql_query += ' WHERE ' + PMA_urldecode(where_clause); -- 2.11.4.GIT