Skip to content

Commit

Permalink
Fixed/Improved mysql escaping in the fields names
Browse files Browse the repository at this point in the history
  • Loading branch information
redvulps committed Nov 22, 2011
1 parent f519909 commit 8b67c8d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/adapters/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,7 @@ MySQL.prototype.toFields = function (model, data) {
var props = this._models[model].properties;
Object.keys(data).forEach(function (key) {
if (props[key]) {
if(key.indexOf('.') != -1) {
keys = key.split('.');

for(var item = 0; item < keys.length; item++) {
keys[item] = '`' + keys[item] + '`';
}

key = keys.join('.');
}

fields.push('`' + key + '` = ' + this.toDatabase(props[key], data[key]));
fields.push('`' + key.replace(/\./g, '`.`') + '` = ' + this.toDatabase(props[key], data[key]));
}
}.bind(this));
return fields.join(',');
Expand Down

0 comments on commit 8b67c8d

Please sign in to comment.