Merge pull request #121 from mhuggins/postgres-in

Allow for IN, NOT IN, and != queries in PostgreSQL
This commit is contained in:
Anatoliy Chakkaev 2012-09-14 02:12:59 -07:00
commit 4ce4a0bc2c
1 changed files with 20 additions and 11 deletions

View File

@ -243,8 +243,17 @@ PG.prototype.toFilter = function (model, filter) {
case 'between':
sqlCond += ' BETWEEN ';
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);
} else {
fields.push('"' + key + '" = ' + filterValue);