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

Commit 9ff786f0 by Peter Braun

"getWhereConditions" in the postgres "QueryGenerator"

can now prepend table names to attributes. This fixes
issue #629.
1 parent 1c562924
Showing with 6 additions and 3 deletions
......@@ -258,7 +258,7 @@ module.exports = (function() {
}
if(options.hasOwnProperty('where')) {
options.where = QueryGenerator.getWhereConditions(options.where)
options.where = QueryGenerator.getWhereConditions(options.where, tableName)
query += " WHERE <%= where %>"
}
......@@ -457,14 +457,17 @@ module.exports = (function() {
})
},
getWhereConditions: function(smth) {
getWhereConditions: function(smth, tableName) {
var result = null
if (Utils.isHash(smth)) {
smth = Utils.prependTableNameToHash(tableName, smth)
result = QueryGenerator.hashToWhereConditions(smth)
}
else if (typeof smth === "number") {
result = '\"id\"' + "=" + QueryGenerator.pgEscape(smth)
smth = QueryGenerator.pgEscape(smth)
smth = Utils.prependTableNameToHash(tableName, { id: smth })
result = QueryGenerator.hashToWhereConditions(smth)
}
else if (typeof smth === "string") {
result = smth
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!