Surround DB name and field names with quotes to distinguish them from SQL key words.

This commit is contained in:
Madhura Jayaratne
2011-03-06 02:30:34 +05:30
parent b9a6342a17
commit 74a61f61da

View File

@@ -772,7 +772,7 @@ $(document).ready(function() {
/** /**
* @var sql_query String containing the SQL query to update this row * @var sql_query String containing the SQL query to update this row
*/ */
var sql_query = 'UPDATE ' + window.parent.table + ' SET '; var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
$input_siblings.each(function() { $input_siblings.each(function() {
/** @lends jQuery */ /** @lends jQuery */
@@ -801,7 +801,7 @@ $(document).ready(function() {
var value; var value;
if (is_null) { if (is_null) {
sql_query += ' ' + field_name + "=NULL , "; sql_query += ' `' + field_name + "`=NULL , ";
} else { } else {
if($this_field.is(":not(.relation, .enum, .set)")) { if($this_field.is(":not(.relation, .enum, .set)")) {
this_field_params[field_name] = $this_field.find('textarea').val(); this_field_params[field_name] = $this_field.find('textarea').val();
@@ -830,7 +830,7 @@ $(document).ready(function() {
$.extend(relation_fields, this_field_params); $.extend(relation_fields, this_field_params);
} }
} }
sql_query += ' ' + field_name + "='" + this_field_params[field_name].replace(/'/g, "''") + "' , "; sql_query += ' `' + field_name + "`='" + this_field_params[field_name].replace(/'/g, "''") + "' , ";
} }
}) })