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

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() {
// Filter statement
// Used by both join and subquery where
if (subQuery && !include.subQuery && include.parent.subQuery) {
where = self.quoteIdentifier(tableLeft + "." + attrLeft) + " = "
} else {
where = self.quoteTable(tableLeft) + "." + self.quoteIdentifier(attrLeft) + " = "
}
where += self.quoteTable(tableRight) + "." + self.quoteIdentifier(attrRight)
where =
// Left side
(
( subQuery && !include.subQuery && include.parent.subQuery && !( include.hasParentRequired && include.hasParentWhere ) ) && self.quoteIdentifier(tableLeft + "." + attrLeft) ||
self.quoteTable(tableLeft) + "." + self.quoteIdentifier(attrLeft)
)
+ " = " +
// 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
joinQueryItem += joinType + self.quoteTable(table, as) + " ON "
......
......@@ -854,7 +854,8 @@ describe(Support.getTestDialectTeaser("Include"), function () {
]
}).done(function (err, john) {
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();
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!