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

Commit 1f1364d6 by Daniel Durante

Merge branch 'postgres-clause-order-fix' of git://github.com/mekanics/sequelize

…into mekanics-postgres-clause-order-fix
2 parents 1c562924 34ed0d70
Showing with 7 additions and 7 deletions
...@@ -262,13 +262,6 @@ module.exports = (function() { ...@@ -262,13 +262,6 @@ module.exports = (function() {
query += " WHERE <%= where %>" query += " WHERE <%= where %>"
} }
if(options.order) {
options.order = options.order.replace(/([^ ]+)(.*)/, function(m, g1, g2) {
return QueryGenerator.addQuotes(g1) + g2
})
query += " ORDER BY <%= order %>"
}
if(options.group) { if(options.group) {
if (Array.isArray(options.group)) { if (Array.isArray(options.group)) {
options.group = options.group.map(function(grp){ options.group = options.group.map(function(grp){
...@@ -281,6 +274,13 @@ module.exports = (function() { ...@@ -281,6 +274,13 @@ module.exports = (function() {
query += " GROUP BY <%= group %>" query += " GROUP BY <%= group %>"
} }
if(options.order) {
options.order = options.order.replace(/([^ ]+)(.*)/, function(m, g1, g2) {
return QueryGenerator.addQuotes(g1) + g2
})
query += " ORDER BY <%= order %>"
}
if (!(options.include && (options.limit === 1))) { if (!(options.include && (options.limit === 1))) {
if (options.limit) { if (options.limit) {
query += " LIMIT <%= limit %>" query += " LIMIT <%= limit %>"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!