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

Commit df521949 by Mick Hansen

Minor cleanup

1 parent 143e0881
Showing with 9 additions and 4 deletions
...@@ -483,6 +483,10 @@ module.exports = (function() { ...@@ -483,6 +483,10 @@ module.exports = (function() {
mainAttributes = mainAttributes && mainAttributes.map(function(attr){ mainAttributes = mainAttributes && mainAttributes.map(function(attr){
var addTable = true var addTable = true
if (attr instanceof Utils.literal) {
return attr.toString(this)
}
if (attr instanceof Utils.fn || attr instanceof Utils.col) { if (attr instanceof Utils.fn || attr instanceof Utils.col) {
return self.quote(attr) return self.quote(attr)
} }
...@@ -592,10 +596,11 @@ module.exports = (function() { ...@@ -592,10 +596,11 @@ module.exports = (function() {
if (subQuery) { if (subQuery) {
if (!options.where) options.where = {} if (!options.where) options.where = {}
var _where = "(SELECT "+self.quoteIdentifier(identSource)+" FROM " + self.quoteIdentifier(throughTable) + " AS " + self.quoteIdentifier(throughAs); var _where = "(";
_where += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON "; _where += "SELECT "+self.quoteIdentifier(identSource)+" FROM " + self.quoteIdentifier(throughTable) + " AS " + self.quoteIdentifier(throughAs);
_where += targetJoinOn; _where += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON "+targetJoinOn;
_where += " WHERE " + sourceJoinOn + " AND " + targetWhere + " LIMIT 1)"; _where += " WHERE " + sourceJoinOn + " AND " + targetWhere + " LIMIT 1"
_where += ")";
_where += " IS NOT NULL" _where += " IS NOT NULL"
options.where["__"+throughAs] = self.sequelize.asIs(_where) options.where["__"+throughAs] = self.sequelize.asIs(_where)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!