提交 361f4701 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Detect row values in getExpressionColumns()

上级 1654119e
...@@ -15,7 +15,7 @@ import org.h2.table.ColumnResolver; ...@@ -15,7 +15,7 @@ import org.h2.table.ColumnResolver;
import org.h2.table.TableFilter; import org.h2.table.TableFilter;
import org.h2.value.TypeInfo; import org.h2.value.TypeInfo;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueArray; import org.h2.value.ValueCollectionBase;
/** /**
* An expression is a operation, a value, or a function in a query. * An expression is a operation, a value, or a function in a query.
...@@ -370,7 +370,7 @@ public abstract class Expression { ...@@ -370,7 +370,7 @@ public abstract class Expression {
* @param value the value to extract columns from * @param value the value to extract columns from
* @return array of expression columns * @return array of expression columns
*/ */
protected static Expression[] getExpressionColumns(Session session, ValueArray value) { protected static Expression[] getExpressionColumns(Session session, ValueCollectionBase value) {
Value[] list = value.getList(); Value[] list = value.getList();
ExpressionColumn[] expr = new ExpressionColumn[list.length]; ExpressionColumn[] expr = new ExpressionColumn[list.length];
for (int i = 0, len = list.length; i < len; i++) { for (int i = 0, len = list.length; i < len; i++) {
......
...@@ -13,8 +13,8 @@ import org.h2.table.ColumnResolver; ...@@ -13,8 +13,8 @@ import org.h2.table.ColumnResolver;
import org.h2.table.TableFilter; import org.h2.table.TableFilter;
import org.h2.value.TypeInfo; import org.h2.value.TypeInfo;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueArray;
import org.h2.value.ValueBoolean; import org.h2.value.ValueBoolean;
import org.h2.value.ValueCollectionBase;
import org.h2.value.ValueNull; import org.h2.value.ValueNull;
/** /**
...@@ -163,8 +163,9 @@ public class ValueExpression extends Expression { ...@@ -163,8 +163,9 @@ public class ValueExpression extends Expression {
@Override @Override
public Expression[] getExpressionColumns(Session session) { public Expression[] getExpressionColumns(Session session) {
if (getType().getValueType() == Value.ARRAY) { int valueType = getType().getValueType();
return getExpressionColumns(session, (ValueArray) getValue(session)); if (valueType == Value.ARRAY || valueType == Value.ROW) {
return getExpressionColumns(session, (ValueCollectionBase) getValue(session));
} }
return super.getExpressionColumns(session); return super.getExpressionColumns(session);
} }
......
...@@ -161,6 +161,7 @@ public class JavaFunction extends Expression implements FunctionCall { ...@@ -161,6 +161,7 @@ public class JavaFunction extends Expression implements FunctionCall {
ValueResultSet rs = getValueForColumnList(session, getArgs()); ValueResultSet rs = getValueForColumnList(session, getArgs());
return getExpressionColumns(session, rs.getResult()); return getExpressionColumns(session, rs.getResult());
case Value.ARRAY: case Value.ARRAY:
case Value.ROW:
return getExpressionColumns(session, (ValueArray) getValue(session)); return getExpressionColumns(session, (ValueArray) getValue(session));
} }
return super.getExpressionColumns(session); return super.getExpressionColumns(session);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论