提交 ab39b595 authored 作者: Thomas Mueller's avatar Thomas Mueller

Conditions with many OR operations could throw an UnsupportedOperationException.

上级 86a62502
...@@ -14,6 +14,7 @@ import org.h2.index.IndexCondition; ...@@ -14,6 +14,7 @@ import org.h2.index.IndexCondition;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.table.ColumnResolver; import org.h2.table.ColumnResolver;
import org.h2.table.TableFilter; import org.h2.table.TableFilter;
import org.h2.util.New;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueBoolean; import org.h2.value.ValueBoolean;
import org.h2.value.ValueNull; import org.h2.value.ValueNull;
...@@ -451,13 +452,13 @@ public class Comparison extends Condition { ...@@ -451,13 +452,13 @@ public class Comparison extends Condition {
// a=b OR a=c // a=b OR a=c
Database db = session.getDatabase(); Database db = session.getDatabase();
if (rc && r2c && l.equals(l2)) { if (rc && r2c && l.equals(l2)) {
return new ConditionIn(db, left, Arrays.asList(right, other.right)); return new ConditionIn(db, left, New.arrayList(Arrays.asList(right, other.right)));
} else if (rc && l2c && l.equals(r2)) { } else if (rc && l2c && l.equals(r2)) {
return new ConditionIn(db, left, Arrays.asList(right, other.left)); return new ConditionIn(db, left, New.arrayList(Arrays.asList(right, other.left)));
} else if (lc && r2c && r.equals(l2)) { } else if (lc && r2c && r.equals(l2)) {
return new ConditionIn(db, right, Arrays.asList(left, other.right)); return new ConditionIn(db, right, New.arrayList(Arrays.asList(left, other.right)));
} else if (lc && l2c && r.equals(r2)) { } else if (lc && l2c && r.equals(r2)) {
return new ConditionIn(db, right, Arrays.asList(left, other.left)); return new ConditionIn(db, right, New.arrayList(Arrays.asList(left, other.left)));
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
package org.h2.expression; package org.h2.expression;
import java.util.List; import java.util.ArrayList;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.engine.Session; import org.h2.engine.Session;
...@@ -25,7 +25,7 @@ public class ConditionIn extends Condition { ...@@ -25,7 +25,7 @@ public class ConditionIn extends Condition {
private final Database database; private final Database database;
private Expression left; private Expression left;
private final List<Expression> valueList; private final ArrayList<Expression> valueList;
private int queryLevel; private int queryLevel;
/** /**
...@@ -35,7 +35,7 @@ public class ConditionIn extends Condition { ...@@ -35,7 +35,7 @@ public class ConditionIn extends Condition {
* @param left the expression before IN * @param left the expression before IN
* @param values the value list (at least one element) * @param values the value list (at least one element)
*/ */
public ConditionIn(Database database, Expression left, List<Expression> values) { public ConditionIn(Database database, Expression left, ArrayList<Expression> values) {
this.database = database; this.database = database;
this.left = left; this.left = left;
this.valueList = values; this.valueList = values;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论