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

Commit ecf29be1 by José Moreira

Alias from SubQuery vs Column.Field and better expects on test unit

Fixes #1640
1 parent 6eb60161
...@@ -763,13 +763,20 @@ module.exports = (function() { ...@@ -763,13 +763,20 @@ module.exports = (function() {
// Filter statement // Filter statement
// Used by both join and subquery where // Used by both join and subquery where
where =
if (subQuery && !include.subQuery && include.parent.subQuery) { // Left side
where = self.quoteIdentifier(tableLeft + "." + attrLeft) + " = " (
} else { ( subQuery && !include.subQuery && include.parent.subQuery && !( include.hasParentRequired && include.hasParentWhere ) ) && self.quoteIdentifier(tableLeft + "." + attrLeft) ||
where = self.quoteTable(tableLeft) + "." + self.quoteIdentifier(attrLeft) + " = " self.quoteTable(tableLeft) + "." + self.quoteIdentifier(attrLeft)
} )
where += self.quoteTable(tableRight) + "." + self.quoteIdentifier(attrRight)
+ " = " +
// Right side
(
( subQuery && !include.subQuery && include.parent.subQuery && ( include.hasParentRequired && include.hasParentWhere ) ) && self.quoteIdentifier(tableRight + "." + attrRight) ||
self.quoteTable(tableRight) + "." + self.quoteIdentifier(attrRight)
)
// Generate join SQL // Generate join SQL
joinQueryItem += joinType + self.quoteTable(table, as) + " ON " joinQueryItem += joinType + self.quoteTable(table, as) + " ON "
......
...@@ -854,7 +854,8 @@ describe(Support.getTestDialectTeaser("Include"), function () { ...@@ -854,7 +854,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
] ]
}).done(function (err, john) { }).done(function (err, john) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
expect(john.addresses).to.have.length(1) expect(john.address).to.be.ok
expect(john.address.street).to.be.ok
done(); done();
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!