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

Commit 62bd98f0 by Mick Hansen

prepend is a no op if theres no tableName so dont mark keys as escaped unless we…

… actually did the work
1 parent 528d8439
......@@ -1002,7 +1002,7 @@ module.exports = (function() {
}
} else if (Utils.isHash(smth)) {
if (prepend) {
options.keysEscaped = true
if (tableName) options.keysEscaped = true
smth = this.prependTableNameToHash(tableName, smth)
}
......@@ -1019,7 +1019,7 @@ module.exports = (function() {
where[primaryKeys] = smth
options.keysEscaped = true
if (tableName) options.keysEscaped = true
smth = this.prependTableNameToHash(tableName, where)
result = this.hashToWhereConditions(smth)
} else if (typeof smth === "string") {
......@@ -1051,9 +1051,7 @@ module.exports = (function() {
var _hash = {}
for (var key in hash) {
if (key instanceof Utils.literal) {
_hash[key] = hash[key]
} else if (key.indexOf('.') === -1) {
if (key.indexOf('.') === -1) {
if (tableName instanceof Utils.literal) {
_hash[tableName + '.' + this.quoteIdentifier(key)] = hash[key]
} else {
......
......@@ -44,7 +44,8 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
Article.hasMany(Label)
sequelize.sync({ force: true }).success(function() {
sequelize.sync({ force: true }).done(function(err) {
expect(err).not.to.be.ok
Article.create({ title: 'foo' }).success(function(article) {
Label.create({ text: 'bar' }).success(function(label) {
sequelize.transaction(function(t) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!