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

Commit 6e13407a by Matt Broadstone

unify selectQuery between abstract and mssql dialects

1 parent d1b914f7
......@@ -1083,7 +1083,9 @@ module.exports = (function() {
} else {
if (association.associationType !== 'BelongsTo') {
// Alias the left attribute if the left attribute is not from a subqueried main table
// When doing a query like SELECT aliasedKey FROM (SELECT primaryKey FROM primaryTable) only aliasedKey is available to the join, this is not the case when doing a regular select where you can't used the aliased attribute
// When doing a query like SELECT aliasedKey FROM (SELECT primaryKey FROM primaryTable)
// only aliasedKey is available to the join, this is not the case when doing a regular
// select where you can't used the aliased attribute
if (!subQuery || (subQuery && !include.subQuery && include.parent.model !== mainModel)) {
if (left.rawAttributes[attrLeft].field) {
attrLeft = left.rawAttributes[attrLeft].field;
......
......@@ -3,7 +3,7 @@
var chai = require('chai')
, Sequelize = require('../../index')
, expect = chai.expect
, Support = require(__dirname + '/../support')
, Support = require(__dirname + '/../support')
, dialect = Support.getTestDialect()
, DataTypes = require(__dirname + "/../../lib/data-types")
, datetime = require('chai-datetime')
......@@ -229,7 +229,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
}, callback)
},
function (err) {
console.log('err', err);
// console.log('err', err);
expect(err).not.to.be.ok
done()
}
......@@ -256,14 +256,14 @@ describe(Support.getTestDialectTeaser("Include"), function () {
SubscriptionForm.belongsTo(Category, {foreignKey:'boundCategory'});
Category.hasMany(SubscriptionForm, {foreignKey:'boundCategory'});
Capital.hasMany(Category, { foreignKey: 'boundCapital'});
Category.belongsTo(Capital, {foreignKey:'boundCapital'});
Category.hasMany(SubCategory, {foreignKey:'boundCategory'});
SubCategory.belongsTo(Category, {foreignKey: 'boundCategory'});
return this.sequelize.sync({force: true}).then(function() {
return User.find({
include: [
......@@ -1162,7 +1162,7 @@ describe(Support.getTestDialectTeaser("Include"), function () {
chainer.run().done(callback)
}]
}, function (err) {
}, function (err) {
expect(err).not.to.be.ok
User.findAll({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!