提交 fbce5a3f authored 作者: Max Englander's avatar Max Englander

enum-support: fix Transfer.{read,write}Value for enum

上级 063eb7ea
......@@ -494,6 +494,20 @@ public class Transfer {
}
break;
}
case Value.ENUM: {
ValueEnum ve = (ValueEnum) v;
String[] enumerators = ve.getEnumerators();
writeInt(enumerators.length);
for (String member : enumerators) {
writeString(member);
}
writeInt(ve.getInt());
break;
}
case Value.RESULT_SET: {
try {
ResultSet rs = ((ValueResultSet) v).getResultSet();
......@@ -590,6 +604,14 @@ public class Transfer {
return ValueDouble.get(readDouble());
case Value.FLOAT:
return ValueFloat.get(readFloat());
case Value.ENUM: {
int len = readInt();
String[] enumerators = new String[len];
for (int i = 0; i < len; i++) {
enumerators[i] = readString();
}
return ValueEnum.get(enumerators, readInt());
}
case Value.INT:
return ValueInt.get(readInt());
case Value.LONG:
......
......@@ -127,6 +127,10 @@ public class ValueEnum extends Value {
return DISPLAY_SIZE;
}
public String[] getEnumerators() {
return enumerators;
}
@Override
public int getInt() {
return ordinal;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论