Allow for IN, NOT IN, and != queries in postgres

This commit is contained in:
Matt Huggins 2012-09-13 20:15:46 -04:00
parent 6d33aaaa48
commit c3dd47f448
1 changed files with 20 additions and 11 deletions

View File

@ -243,8 +243,17 @@ PG.prototype.toFilter = function (model, filter) {
case 'between': case 'between':
sqlCond += ' BETWEEN '; sqlCond += ' BETWEEN ';
break; break;
case 'inq':
sqlCond += ' IN ';
break;
case 'nin':
sqlCond += ' NOT IN ';
break;
case 'neq':
sqlCond += ' != ';
break;
} }
sqlCond += filterValue; sqlCond += (condType == 'inq' || condType == 'nin') ? '(' + filterValue + ')' : filterValue;
fields.push(sqlCond); fields.push(sqlCond);
} else { } else {
fields.push('"' + key + '" = ' + filterValue); fields.push('"' + key + '" = ' + filterValue);