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

Commit 94032ce3 by Mick Hansen

provide subquery flag that will turn off subquery logic regardless, closes #1756

1 parent 79c5730a
...@@ -702,7 +702,7 @@ module.exports = (function() { ...@@ -702,7 +702,7 @@ module.exports = (function() {
, mainAttributes = options.attributes && options.attributes.slice(0) , mainAttributes = options.attributes && options.attributes.slice(0)
, mainJoinQueries = [] , mainJoinQueries = []
// We'll use a subquery if we have hasMany associations and a limit and a filtered/required association // We'll use a subquery if we have hasMany associations and a limit and a filtered/required association
, subQuery = limit && (options.hasIncludeWhere || options.hasIncludeRequired || options.hasMultiAssociation) , subQuery = limit && (options.hasIncludeWhere || options.hasIncludeRequired || options.hasMultiAssociation) && options.subQuery !== false
, subQueryItems = [] , subQueryItems = []
, subQueryAttributes = null , subQueryAttributes = null
, subJoinQueries = [] , subJoinQueries = []
......
...@@ -575,6 +575,7 @@ module.exports = (function() { ...@@ -575,6 +575,7 @@ module.exports = (function() {
} }
options.lock = queryOptions.lock; options.lock = queryOptions.lock;
options.subQuery = queryOptions.subQuery;
var sql = this.QueryGenerator.selectQuery(tableName, options, model); var sql = this.QueryGenerator.selectQuery(tableName, options, model);
queryOptions = Utils._.extend({}, queryOptions, { queryOptions = Utils._.extend({}, queryOptions, {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!