提交 56a9668f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix UTF-8 conversion in JdbcResultSet.getBytes(String)

上级 41a502e3
......@@ -1087,7 +1087,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public byte[] getBytes(String columnLabel) throws SQLException {
try {
debugCodeCall("getBytes", columnLabel);
return get(columnLabel).getBytes();
return get(columnLabel).convertTo(Value.BYTES, conn.getMode()).getBytes();
} catch (Exception e) {
throw logAndConvert(e);
}
......
......@@ -337,6 +337,7 @@ public class TestCompatibility extends TestDb {
ResultSet rs = stat.executeQuery("SELECT B FROM TEST2");
assertTrue(rs.next());
assertEquals(bytes, rs.getBytes(1));
assertEquals(bytes, rs.getBytes("B"));
assertEquals(1, stat.executeUpdate("UPDATE TEST2 SET C = B"));
testMySQLBytesCheck(stat, string, bytes);
PreparedStatement prep = conn.prepareStatement("UPDATE TEST2 SET C = ?");
......@@ -452,6 +453,7 @@ public class TestCompatibility extends TestDb {
assertTrue(rs.next());
assertEquals(string, rs.getString(1));
assertEquals(bytes, rs.getBytes(1));
assertEquals(bytes, rs.getBytes("C"));
}
private void testSybaseAndMSSQLServer() throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论