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

Serialization for Geometry data.

上级 cfea9c03
...@@ -38,6 +38,7 @@ import org.h2.value.ValueDate; ...@@ -38,6 +38,7 @@ import org.h2.value.ValueDate;
import org.h2.value.ValueDecimal; import org.h2.value.ValueDecimal;
import org.h2.value.ValueDouble; import org.h2.value.ValueDouble;
import org.h2.value.ValueFloat; import org.h2.value.ValueFloat;
import org.h2.value.ValueGeometry;
import org.h2.value.ValueInt; import org.h2.value.ValueInt;
import org.h2.value.ValueJavaObject; import org.h2.value.ValueJavaObject;
import org.h2.value.ValueLob; import org.h2.value.ValueLob;
...@@ -440,6 +441,15 @@ public class ValueDataType implements DataType { ...@@ -440,6 +441,15 @@ public class ValueDataType implements DataType {
} }
break; break;
} }
case Value.GEOMETRY: {
buff.put((byte) type);
byte[] b = v.getBytes();
int len = b.length;
writeVarInt(buff, len);
buff = DataUtils.ensureCapacity(buff, len);
buff.put(b, 0, len);
break;
}
default: default:
DbException.throwInternalError("type=" + v.getType()); DbException.throwInternalError("type=" + v.getType());
} }
...@@ -651,6 +661,12 @@ public class ValueDataType implements DataType { ...@@ -651,6 +661,12 @@ public class ValueDataType implements DataType {
} }
return ValueResultSet.get(rs); return ValueResultSet.get(rs);
} }
case Value.GEOMETRY: {
int len = readVarInt(buff);
byte[] b = DataUtils.newBytes(len);
buff.get(b, 0, len);
return ValueGeometry.get(b);
}
default: default:
if (type >= INT_0_15 && type < INT_0_15 + 16) { if (type >= INT_0_15 && type < INT_0_15 + 16) {
return ValueInt.get(type - INT_0_15); return ValueInt.get(type - INT_0_15);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论