提交 605302a9 authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 329: CASE expression: data type problem is not detected.

上级 0a1d5431
...@@ -704,6 +704,9 @@ public class DataType { ...@@ -704,6 +704,9 @@ public class DataType {
* @return the data type object * @return the data type object
*/ */
public static DataType getDataType(int type) { public static DataType getDataType(int type) {
if (type == Value.UNKNOWN) {
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?");
}
DataType dt = TYPES_BY_VALUE_TYPE.get(type); DataType dt = TYPES_BY_VALUE_TYPE.get(type);
if (dt == null) { if (dt == null) {
dt = TYPES_BY_VALUE_TYPE.get(Value.NULL); dt = TYPES_BY_VALUE_TYPE.get(Value.NULL);
......
...@@ -310,10 +310,16 @@ public abstract class Value { ...@@ -310,10 +310,16 @@ public abstract class Value {
* @return the higher value type of the two * @return the higher value type of the two
*/ */
public static int getHigherOrder(int t1, int t2) { public static int getHigherOrder(int t1, int t2) {
if (t1 == t2) { if (t1 == Value.UNKNOWN || t2 == Value.UNKNOWN) {
if (t1 == Value.UNKNOWN) { if (t1 == t2) {
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, ?"); throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, ?");
} else if (t1 == Value.NULL) {
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "NULL, ?");
} else if (t2 == Value.NULL) {
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, NULL");
} }
}
if (t1 == t2) {
return t1; return t1;
} }
int o1 = getOrder(t1); int o1 = getOrder(t1);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论