From d99c64721c3fbf7dafa8324c27d7b83d8488f458 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 4 Nov 2019 22:27:59 +0100 Subject: [PATCH] Fix SQLWhereIn when there is no element to compare to --- src/main/java/fr/pandacube/util/orm/SQLWhereIn.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/fr/pandacube/util/orm/SQLWhereIn.java b/src/main/java/fr/pandacube/util/orm/SQLWhereIn.java index b541493..516f663 100644 --- a/src/main/java/fr/pandacube/util/orm/SQLWhereIn.java +++ b/src/main/java/fr/pandacube/util/orm/SQLWhereIn.java @@ -21,6 +21,10 @@ public class SQLWhereIn extends SQLWhere { @Override public Pair> toSQL() throws ORMException { List params = new ArrayList<>(); + + if (values.isEmpty()) + return new Pair<>(" 1=0 ", params); + for (Object v : values) SQLElement.addValueToSQLObjectList(params, field, v);