Merge branch 'master' into autoupdate

This commit is contained in:
Anatoliy Chakkaev 2011-12-09 19:26:48 +04:00
commit 155844eae6
1 changed files with 2 additions and 1 deletions

View File

@ -71,7 +71,7 @@ MySQL.prototype.toFields = function (model, data) {
var props = this._models[model].properties;
Object.keys(data).forEach(function (key) {
if (props[key]) {
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(',');
@ -95,6 +95,7 @@ MySQL.prototype.toDatabase = function (prop, val) {
].join('-');
return this.client.escape(val);
}
if (prop.type.name == "Boolean") return val ? 1 : 0;
return this.client.escape(val.toString());
};