提交 747ec5a7 authored 作者: Thomas Mueller's avatar Thomas Mueller

Geometry: support client/server protocol; improved memory usage estimation.

上级 ce14e488
......@@ -507,6 +507,9 @@ public class Transfer {
}
break;
}
case Value.GEOMETRY:
writeString(v.getString());
break;
default:
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);
}
......@@ -671,6 +674,8 @@ public class Transfer {
}
return ValueResultSet.get(rs);
}
case Value.GEOMETRY:
return ValueGeometry.get(readString());
default:
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);
}
......
......@@ -149,7 +149,7 @@ public class ValueGeometry extends Value {
@Override
public int getMemory() {
return toWKB().length + 24;
return toWKB().length * 20 + 24;
}
@Override
......
......@@ -33,6 +33,7 @@ import org.h2.value.ValueDate;
import org.h2.value.ValueDecimal;
import org.h2.value.ValueDouble;
import org.h2.value.ValueFloat;
import org.h2.value.ValueGeometry;
import org.h2.value.ValueInt;
import org.h2.value.ValueJavaObject;
import org.h2.value.ValueLong;
......@@ -186,6 +187,8 @@ public class TestValueMemory extends TestBase implements DataHandler {
return ValueUuid.get(random.nextLong(), random.nextLong());
case Value.STRING_FIXED:
return ValueStringFixed.get(randomString(random.nextInt(100)));
case Value.GEOMETRY:
return ValueGeometry.get("POINT (" + random.nextInt(100) + " "+random.nextInt(100)+")");
default:
throw new AssertionError("type=" + type);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论