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

Fix for #346

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