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

Commit b484d596 by Sascha Depold

don't re-query after save

1 parent eaa1b54e
Showing with 3 additions and 9 deletions
...@@ -311,15 +311,9 @@ SequelizeTable = function(sequelize, tableName, attributes) { ...@@ -311,15 +311,9 @@ 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) { if(callback) callback(self)
self.id = result.id
if(callback) callback(self)
})
} else {
if(callback) callback(self)
}
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!