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

Commit 9f6c5f04 by Joel Trost Committed by Matt Broadstone

Partial fix for where clause, still issues

1 parent c9ace4d8
Showing with 13 additions and 7 deletions
......@@ -159,8 +159,14 @@ module.exports = (function() {
OR a string with conditions (e.g. 'name="foo"').
If you use a string, you have to escape it on your own.
*/
updateQuery: function(tableName, attrValueHash, where, options, attributes) {
throwMethodUndefined('updateQuery');
updateQuery: function(tableName, attrValueHash, where, options, attributes) {
console.log(where);
var query = [
SqlGenerator.updateSql(tableName, attrValueHash, attributes),
this.getWhereConditions(where)
].join(' ') + ';';
console.log(query);
return query;
},
/*
Returns a deletion query.
......@@ -399,7 +405,7 @@ module.exports = (function() {
if(options.hasOwnProperty('where')){
query.push(this.getWhereConditions(options.where, model.name, model, options));
}
//console.log(query);
//console.log(query.join(' ') + ';');
return query.join(' ') + ';';
},
/**
......@@ -489,12 +495,12 @@ module.exports = (function() {
/*
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('logic', smth);
if(!smth){
return SqlGenerator.getWhereClause(tableName, model, options);
console.log('logic', where);
if(where){
return SqlGenerator.getWhereClause(where, tableName);
}else{
return '';
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!