不要怂,就是干,撸起袖子干!

Commit d1b914f7 by Matt Broadstone

remove faulty logic in update code

1 parent 69dc2200
Showing with 18 additions and 20 deletions
......@@ -226,30 +226,28 @@ module.exports = (function() {
var query;
attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, false, options);
//very unique case for cascades, i generally don't approve
if(Object.keys(attrValueHash).length === 1 && attributes[Object.keys(attrValueHash)[0]].primaryKey){
this.sequelize.log('Updating a Primary Key is not supported in MSSQL, please restructure your query');
}else{
for(var key in attributes){
var aliasKey = attributes[key].field || key;
if(attributes[key].primaryKey && attrValueHash[aliasKey]){
delete attrValueHash[aliasKey];
}
if(attrValueHash[aliasKey] && attrValueHash[aliasKey].fn){
}
for (var key in attributes) {
var aliasKey = attributes[key].field || key;
if (attributes[key].primaryKey && attrValueHash[aliasKey]) {
delete attrValueHash[aliasKey];
}
if(!Object.keys(attrValueHash).length){
return '';
//return ['SELECT * FROM ', tableName, 'WHERE', this.getWhereConditions(where) + ';'].join(' ');
if (attrValueHash[aliasKey] && attrValueHash[aliasKey].fn) {
}
query = [
SqlGenerator.updateSql(tableName, attrValueHash, attributes),
'WHERE',
this.getWhereConditions(where)
].join(' ') + ';';
}
if (!Object.keys(attrValueHash).length) {
return '';
//return ['SELECT * FROM ', tableName, 'WHERE', this.getWhereConditions(where) + ';'].join(' ');
}
query = [
SqlGenerator.updateSql(tableName, attrValueHash, attributes),
'WHERE',
this.getWhereConditions(where)
].join(' ') + ';';
return query;
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!