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

Commit 060b9352 by Mathieu Amiot

Adding HAVING clause support to generic query generator

1 parent e1d048e2
Showing with 10 additions and 1 deletions
...@@ -703,6 +703,16 @@ module.exports = (function() { ...@@ -703,6 +703,16 @@ module.exports = (function() {
mainQueryItems.push(" GROUP BY " + options.group) mainQueryItems.push(" GROUP BY " + options.group)
} }
} }
// Add HAVING to sub or main query
if (options.hasOwnProperty('having')) {
options.having = this.getWhereConditions(options.having, tableName, factory, options)
if (subQuery) {
subQueryItems.push(" HAVING " + options.having)
} else {
mainQueryItems.push(" HAVING " + options.having)
}
}
// Add ORDER to sub or main query // Add ORDER to sub or main query
if (options.order) { if (options.order) {
...@@ -715,7 +725,6 @@ module.exports = (function() { ...@@ -715,7 +725,6 @@ module.exports = (function() {
} }
} }
var limitOrder = this.addLimitAndOffset(options, query) var limitOrder = this.addLimitAndOffset(options, query)
// Add LIMIT, OFFSET to sub or main query // Add LIMIT, OFFSET to sub or main query
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!