提交 8c4e7771 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #370 from marschall/getObject-byte-array

Support byte[] in getObject
......@@ -3773,6 +3773,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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论