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

Commit b484d596 by Sascha Depold

don't re-query after save

1 parent eaa1b54e
Showing with 2 additions and 8 deletions
...@@ -311,16 +311,10 @@ SequelizeTable = function(sequelize, tableName, attributes) { ...@@ -311,16 +311,10 @@ SequelizeTable = function(sequelize, tableName, attributes) {
} else } else
query = Sequelize.sqlQueryFor('update', { table: table.tableName, values: SequelizeHelper.SQL.valuesForUpdate(this), id: this.id }) query = Sequelize.sqlQueryFor('update', { table: table.tableName, values: SequelizeHelper.SQL.valuesForUpdate(this), id: this.id })
sequelize.query(query, function() { sequelize.query(query, function(result, stats) {
if(self.id == null) { self.id = self.id || stats.insert_id
table.find(self.values, function(result) {
self.id = result.id
if(callback) callback(self) if(callback) callback(self)
}) })
} else {
if(callback) callback(self)
}
})
}, },
updateAttributes: function(newValues, callback) { updateAttributes: function(newValues, callback) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!