Skip to content

Commit b3fd989

Browse files
authored
Merge pull request #2 from PruvoNet/nested-filters
Nested filters
2 parents f91dee6 + d1ea01e commit b3fd989

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/sql.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,13 @@ SQLConnector.prototype._buildWhere = function(model, where) {
11311131
branches.push(stmtForClause.sql);
11321132
}
11331133
}
1134-
stmt.merge({
1135-
sql: '(' + branches.join(' ' + key.toUpperCase() + ' ') + ')',
1136-
params: branchParams,
1137-
});
1138-
whereStmts.push(stmt);
1134+
if (branches.length > 0) {
1135+
stmt.merge({
1136+
sql: '(' + branches.join(' ' + key.toUpperCase() + ' ') + ')',
1137+
params: branchParams,
1138+
});
1139+
whereStmts.push(stmt);
1140+
}
11391141
continue;
11401142
}
11411143
// The value is not an array, fall back to regular fields

0 commit comments

Comments
 (0)