From a62e06d367b64da456046534260d705fbe35a01c Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Wed, 20 May 2015 09:20:35 -0700 Subject: [PATCH] Fix for https://github.com/strongloop/loopback-connector-postgresql/issues/80 --- lib/sql.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sql.js b/lib/sql.js index 301b0ba6..26a442b7 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -639,7 +639,7 @@ SQLConnector.prototype.buildExpression = function(columnName, operator, columnVa function buildClause(columnValue, separator, grouping) { var values = []; for (var i = 0, n = columnValue.length; i < n; i++) { - if (columnValue instanceof ParameterizedSQL) { + if (columnValue[i] instanceof ParameterizedSQL) { values.push(columnValue[i]); } else { values.push(new ParameterizedSQL(PLACEHOLDER, [columnValue[i]])); @@ -749,8 +749,7 @@ SQLConnector.prototype._buildWhere = function(model, where) { var sqlExp; if (expression === null || expression === undefined) { stmt.merge(columnName + ' IS NULL'); - } else if (expression && - (typeof expression === 'object' && !Array.isArray(expression))) { + } else if (expression && expression.constructor === Object) { var operator = Object.keys(expression)[0]; // Get the expression without the operator expression = expression[operator];