提交 df836eaa authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Create ValueExpression for empty rows and arrays in Parser

上级 05db33de
...@@ -222,6 +222,7 @@ import org.h2.value.ExtTypeInfo; ...@@ -222,6 +222,7 @@ import org.h2.value.ExtTypeInfo;
import org.h2.value.ExtTypeInfoEnum; import org.h2.value.ExtTypeInfoEnum;
import org.h2.value.ExtTypeInfoGeometry; import org.h2.value.ExtTypeInfoGeometry;
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.ValueBytes; import org.h2.value.ValueBytes;
import org.h2.value.ValueDate; import org.h2.value.ValueDate;
...@@ -230,6 +231,7 @@ import org.h2.value.ValueInt; ...@@ -230,6 +231,7 @@ import org.h2.value.ValueInt;
import org.h2.value.ValueInterval; import org.h2.value.ValueInterval;
import org.h2.value.ValueLong; import org.h2.value.ValueLong;
import org.h2.value.ValueNull; import org.h2.value.ValueNull;
import org.h2.value.ValueRow;
import org.h2.value.ValueString; import org.h2.value.ValueString;
import org.h2.value.ValueTime; import org.h2.value.ValueTime;
import org.h2.value.ValueTimestamp; import org.h2.value.ValueTimestamp;
...@@ -3802,7 +3804,7 @@ public class Parser { ...@@ -3802,7 +3804,7 @@ public class Parser {
case OPEN_PAREN: case OPEN_PAREN:
read(); read();
if (readIf(CLOSE_PAREN)) { if (readIf(CLOSE_PAREN)) {
r = new ExpressionList(new Expression[0], false); r = ValueExpression.get(ValueRow.getEmpty());
} else { } else {
r = readExpression(); r = readExpression();
if (readIfMore(true)) { if (readIfMore(true)) {
...@@ -3817,27 +3819,30 @@ public class Parser { ...@@ -3817,27 +3819,30 @@ public class Parser {
} }
} }
break; break;
case ARRAY: { case ARRAY:
read(); read();
read(OPEN_BRACKET); read(OPEN_BRACKET);
if (readIf(CLOSE_BRACKET)) {
r = ValueExpression.get(ValueArray.getEmpty());
} else {
ArrayList<Expression> list = Utils.newSmallArrayList(); ArrayList<Expression> list = Utils.newSmallArrayList();
if (!readIf(CLOSE_BRACKET)) {
list.add(readExpression()); list.add(readExpression());
while (readIf(COMMA)) { while (readIf(COMMA)) {
list.add(readExpression()); list.add(readExpression());
} }
read(CLOSE_BRACKET); read(CLOSE_BRACKET);
r = new ExpressionList(list.toArray(new Expression[0]), true);
} }
return new ExpressionList(list.toArray(new Expression[0]), true); break;
}
case INTERVAL: case INTERVAL:
read(); read();
return readInterval(); r = readInterval();
break;
case ROW: { case ROW: {
read(); read();
read(OPEN_PAREN); read(OPEN_PAREN);
if (readIf(CLOSE_PAREN)) { if (readIf(CLOSE_PAREN)) {
r = new ExpressionList(new Expression[0], false); r = ValueExpression.get(ValueRow.getEmpty());
} else { } else {
ArrayList<Expression> list = Utils.newSmallArrayList(); ArrayList<Expression> list = Utils.newSmallArrayList();
do { do {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论