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

Commit 5a4bf2fa by Mick Hansen

Comments on comments on comments

1 parent ffb5fcba
Showing with 11 additions and 0 deletions
......@@ -462,6 +462,8 @@ module.exports = (function() {
*/
selectQuery: function(tableName, options, factory) {
// Enter and change at your own peril -- Mick Hansen
options = options || {}
var table = null
......@@ -583,15 +585,21 @@ module.exports = (function() {
mainAttributes = mainAttributes.concat(throughAttributes)
}
// Filter statement for left side of through
// Used by both join and subquery where
sourceJoinOn = self.quoteIdentifier(tableSource) + "." + self.quoteIdentifier(attrSource) + " = "
sourceJoinOn += self.quoteIdentifier(throughAs) + "." + self.quoteIdentifier(identSource)
// Filter statement for right side of through
// Used by both join and subquery where
targetJoinOn = self.quoteIdentifier(tableTarget) + "." + self.quoteIdentifier(attrTarget) + " = "
targetJoinOn += self.quoteIdentifier(throughAs) + "." + self.quoteIdentifier(identTarget)
// Generate join SQL for left side of through
joinQueryItem += joinType + self.quoteIdentifier(throughTable) + " AS " + self.quoteIdentifier(throughAs) + " ON "
joinQueryItem += sourceJoinOn
// Generate join SQL for right side of through
joinQueryItem += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON "
joinQueryItem += targetJoinOn
......@@ -621,9 +629,12 @@ module.exports = (function() {
, attrRight = association.identifier
, where
// Filter statement
// Used by both join and subquery where
where = self.quoteIdentifier(tableLeft) + "." + self.quoteIdentifier(attrLeft) + " = "
where += self.quoteIdentifier(tableRight) + "." + self.quoteIdentifier(attrRight)
// Generate join SQL
joinQueryItem += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON "
joinQueryItem += where
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!