提交 c9919dae authored 作者: Philippe Marschall's avatar Philippe Marschall

Support byte[] in getObject

The current implementation of getObject does not support byte[]. This
is an issue for some people [1].

 [1] https://groups.google.com/forum/#!topic/h2-database/InWprFw2B0o
上级 9ecfb9eb
......@@ -3757,6 +3757,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
return type.cast(value.getTimestamp());
} else if (type == UUID.class) {
return type.cast(value.getObject());
} else if (type == byte[].class) {
return type.cast(value.getBytes());
} else if (type == TimestampWithTimeZone.class) {
return type.cast(value.getObject());
} else if (type.isAssignableFrom(Geometry.class)) {
......
......@@ -1227,11 +1227,19 @@ public class TestResultSet extends TestBase {
(byte) 0x01, (byte) 0x01 },
rs.getBytes(2));
assertTrue(!rs.wasNull());
assertEqualsWithNull(new byte[] { (byte) 0x01, (byte) 0x01,
(byte) 0x01, (byte) 0x01 },
((JdbcResultSetBackwardsCompat) rs).getObject(2, byte[].class));
assertTrue(!rs.wasNull());
rs.next();
assertEqualsWithNull(new byte[] { (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x02 },
rs.getBytes("value"));
assertTrue(!rs.wasNull());
assertEqualsWithNull(new byte[] { (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x02 },
((JdbcResultSetBackwardsCompat) rs).getObject("value", byte[].class));
assertTrue(!rs.wasNull());
rs.next();
assertEqualsWithNull(new byte[] { (byte) 0x00 },
readAllBytes(rs.getBinaryStream(2)));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论