提交 5b8374a2 authored 作者: Sergi Vladykin's avatar Sergi Vladykin

Fix for #346

上级 57a2c96f
......@@ -909,12 +909,14 @@ public abstract class Value {
switch (getType()) {
case BYTES:
return ValueUuid.get(getBytesNoCopy());
case JAVA_OBJECT:
case TIMESTAMP_TZ:
throw DbException.get(
ErrorCode.DATA_CONVERSION_ERROR_1, getString());
}
break;
}
case GEOMETRY:
case GEOMETRY: {
switch (getType()) {
case BYTES:
return ValueGeometry.get(getBytesNoCopy());
......@@ -927,6 +929,8 @@ public abstract class Value {
throw DbException.get(
ErrorCode.DATA_CONVERSION_ERROR_1, getString());
}
break;
}
}
// conversion by parsing the string value
String s = getString();
......
......@@ -14,8 +14,9 @@ import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.UUID;
import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.DbException;
import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows;
import org.h2.tools.SimpleResultSet;
......@@ -26,6 +27,7 @@ import org.h2.value.ValueBytes;
import org.h2.value.ValueDecimal;
import org.h2.value.ValueDouble;
import org.h2.value.ValueFloat;
import org.h2.value.ValueJavaObject;
import org.h2.value.ValueLobDb;
import org.h2.value.ValueNull;
import org.h2.value.ValueResultSet;
......@@ -282,6 +284,9 @@ public class TestValue extends TestBase {
assertEquals("ffffffff-ffff-4fff-bfff-ffffffffffff", max.getString());
ValueUuid min = ValueUuid.get(minHigh, minLow);
assertEquals("00000000-0000-4000-8000-000000000000", min.getString());
ValueJavaObject vo = ValueJavaObject.getNoCopy(UUID.randomUUID(), null, null);
assertThrows(DbException.class, vo).convertTo(Value.UUID);
}
private void testModulusDouble() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论