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

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() { ...@@ -1002,7 +1002,7 @@ module.exports = (function() {
} }
} else if (Utils.isHash(smth)) { } else if (Utils.isHash(smth)) {
if (prepend) { if (prepend) {
options.keysEscaped = true if (tableName) options.keysEscaped = true
smth = this.prependTableNameToHash(tableName, smth) smth = this.prependTableNameToHash(tableName, smth)
} }
...@@ -1019,7 +1019,7 @@ module.exports = (function() { ...@@ -1019,7 +1019,7 @@ module.exports = (function() {
where[primaryKeys] = smth where[primaryKeys] = smth
options.keysEscaped = true if (tableName) options.keysEscaped = true
smth = this.prependTableNameToHash(tableName, where) smth = this.prependTableNameToHash(tableName, where)
result = this.hashToWhereConditions(smth) result = this.hashToWhereConditions(smth)
} else if (typeof smth === "string") { } else if (typeof smth === "string") {
...@@ -1051,9 +1051,7 @@ module.exports = (function() { ...@@ -1051,9 +1051,7 @@ module.exports = (function() {
var _hash = {} var _hash = {}
for (var key in hash) { for (var key in hash) {
if (key instanceof Utils.literal) { if (key.indexOf('.') === -1) {
_hash[key] = hash[key]
} else if (key.indexOf('.') === -1) {
if (tableName instanceof Utils.literal) { if (tableName instanceof Utils.literal) {
_hash[tableName + '.' + this.quoteIdentifier(key)] = hash[key] _hash[tableName + '.' + this.quoteIdentifier(key)] = hash[key]
} else { } else {
......
...@@ -44,7 +44,8 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -44,7 +44,8 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
Article.hasMany(Label) 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) { Article.create({ title: 'foo' }).success(function(article) {
Label.create({ text: 'bar' }).success(function(label) { Label.create({ text: 'bar' }).success(function(label) {
sequelize.transaction(function(t) { 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!