Fix SQLWhereIn when there is no element to compare to

This commit is contained in:
Marc Baloup 2019-11-04 22:27:59 +01:00
parent bcb46b7cd5
commit d99c64721c

View File

@ -21,6 +21,10 @@ public class SQLWhereIn extends SQLWhere {
@Override @Override
public Pair<String, List<Object>> toSQL() throws ORMException { public Pair<String, List<Object>> toSQL() throws ORMException {
List<Object> params = new ArrayList<>(); List<Object> params = new ArrayList<>();
if (values.isEmpty())
return new Pair<>(" 1=0 ", params);
for (Object v : values) for (Object v : values)
SQLElement.addValueToSQLObjectList(params, field, v); SQLElement.addValueToSQLObjectList(params, field, v);