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

Commit 9f6c5f04 by Joel Trost Committed by Matt Broadstone

Partial fix for where clause, still issues

1 parent c9ace4d8
Showing with 12 additions and 6 deletions
...@@ -160,7 +160,13 @@ module.exports = (function() { ...@@ -160,7 +160,13 @@ module.exports = (function() {
If you use a string, you have to escape it on your own. If you use a string, you have to escape it on your own.
*/ */
updateQuery: function(tableName, attrValueHash, where, options, attributes) { updateQuery: function(tableName, attrValueHash, where, options, attributes) {
throwMethodUndefined('updateQuery'); console.log(where);
var query = [
SqlGenerator.updateSql(tableName, attrValueHash, attributes),
this.getWhereConditions(where)
].join(' ') + ';';
console.log(query);
return query;
}, },
/* /*
Returns a deletion query. Returns a deletion query.
...@@ -399,7 +405,7 @@ module.exports = (function() { ...@@ -399,7 +405,7 @@ module.exports = (function() {
if(options.hasOwnProperty('where')){ if(options.hasOwnProperty('where')){
query.push(this.getWhereConditions(options.where, model.name, model, options)); query.push(this.getWhereConditions(options.where, model.name, model, options));
} }
//console.log(query); //console.log(query.join(' ') + ';');
return query.join(' ') + ';'; return query.join(' ') + ';';
}, },
/** /**
...@@ -489,12 +495,12 @@ module.exports = (function() { ...@@ -489,12 +495,12 @@ module.exports = (function() {
/* /*
Takes something and transforms it into values of a where condition. Takes something and transforms it into values of a where condition.
*/ */
getWhereConditions: function(smth, tableName, model, options, prepend) { getWhereConditions: function(where, tableName, model, options, prepend) {
//console.log('where:', model); //console.log('where:', model);
//console.log('logic', smth); console.log('logic', where);
if(!smth){ if(where){
return SqlGenerator.getWhereClause(tableName, model, options); return SqlGenerator.getWhereClause(where, tableName);
}else{ }else{
return ''; return '';
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!