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

Commit 872f66ef by Mick Hansen

more use of quoteTable

1 parent 027d914e
...@@ -701,7 +701,7 @@ module.exports = (function() { ...@@ -701,7 +701,7 @@ module.exports = (function() {
joinQueryItem += sourceJoinOn joinQueryItem += sourceJoinOn
// Generate join SQL for right side of through // Generate join SQL for right side of through
joinQueryItem += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON " joinQueryItem += joinType + self.quoteTable(table) + " AS " + self.quoteIdentifier(as) + " ON "
joinQueryItem += targetJoinOn joinQueryItem += targetJoinOn
...@@ -714,7 +714,7 @@ module.exports = (function() { ...@@ -714,7 +714,7 @@ module.exports = (function() {
// Creating the as-is where for the subQuery, checks that the required association exists // Creating the as-is where for the subQuery, checks that the required association exists
var _where = "("; var _where = "(";
_where += "SELECT "+self.quoteIdentifier(identSource)+" FROM " + self.quoteIdentifier(throughTable) + " AS " + self.quoteIdentifier(throughAs); _where += "SELECT "+self.quoteIdentifier(identSource)+" FROM " + self.quoteIdentifier(throughTable) + " AS " + self.quoteIdentifier(throughAs);
_where += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON "+targetJoinOn; _where += joinType + self.quoteTable(table) + " AS " + self.quoteIdentifier(as) + " ON "+targetJoinOn;
_where += " WHERE " + sourceJoinOn + " AND " + targetWhere + " LIMIT 1" _where += " WHERE " + sourceJoinOn + " AND " + targetWhere + " LIMIT 1"
_where += ")"; _where += ")";
_where += " IS NOT NULL" _where += " IS NOT NULL"
...@@ -736,12 +736,12 @@ module.exports = (function() { ...@@ -736,12 +736,12 @@ module.exports = (function() {
if (subQuery && !include.subQuery && include.parent.subQuery) { if (subQuery && !include.subQuery && include.parent.subQuery) {
where = self.quoteIdentifier(tableLeft + "." + attrLeft) + " = " where = self.quoteIdentifier(tableLeft + "." + attrLeft) + " = "
} else { } else {
where = self.quoteIdentifier(tableLeft) + "." + self.quoteIdentifier(attrLeft) + " = " where = self.quoteTable(tableLeft) + "." + self.quoteIdentifier(attrLeft) + " = "
} }
where += self.quoteIdentifier(tableRight) + "." + self.quoteIdentifier(attrRight) where += self.quoteTable(tableRight) + "." + self.quoteIdentifier(attrRight)
// Generate join SQL // Generate join SQL
joinQueryItem += joinType + self.quoteIdentifier(table) + " AS " + self.quoteIdentifier(as) + " ON " joinQueryItem += joinType + self.quoteTable(table) + " AS " + self.quoteIdentifier(as) + " ON "
joinQueryItem += where joinQueryItem += where
if (include.where) { if (include.where) {
......
...@@ -92,8 +92,6 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() { ...@@ -92,8 +92,6 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
task.getUserXYZ().success(function(user) { task.getUserXYZ().success(function(user) {
expect(user).to.be.ok expect(user).to.be.ok
done() done()
}).on('sql', function (sql) {
console.log(sql)
}) })
}) })
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!