Skip to content
Permalink
Browse files

[misc] utf8 test correction

  • Loading branch information...
rusher committed Feb 6, 2019
1 parent 5ebad18 commit be8e57f7a49af8afb4b5d6730442966ae05a289b
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/test/java/org/mariadb/jdbc/DatatypeTest.java
@@ -103,7 +103,7 @@ public static void initClass() throws SQLException {
createTable("objecttest", "int_test int primary key not null, string_test varchar(30), "
+ "timestamp_test timestamp, serial_test blob");
createTable("bintest",
"id int not null primary key auto_increment, bin1 varbinary(300), bin2 varbinary(300), str1 varchar(256)");
"id int not null primary key auto_increment, bin1 varbinary(300), bin2 varbinary(300)");
createTable("bigdectest", "id int not null primary key auto_increment, bd decimal",
"engine=innodb");
createTable("bytetest", "id int not null primary key auto_increment, a int", "engine=innodb");
@@ -607,17 +607,16 @@ public void binTest() throws SQLException, IOException {
}
ByteArrayInputStream bais = new ByteArrayInputStream(allBytes);
PreparedStatement ps = sharedConnection
.prepareStatement("insert into bintest (bin1,bin2, str1) values (?,?,?)");
.prepareStatement("insert into bintest (bin1,bin2) values (?,?)");
ps.setBytes(1, allBytes);
ps.setBinaryStream(2, bais);
ps.setString(3, new String(allBytes, StandardCharsets.UTF_8) );
ps.execute();

try (ResultSet rs = getResultSet("select bin1,bin2,str1 from bintest", false)) {
try (ResultSet rs = getResultSet("select bin1,bin2 from bintest", false)) {
binTestResult(rs, allBytes);
}

try (ResultSet rs = getResultSet("select bin1,bin2,str1 from bintest", true)) {
try (ResultSet rs = getResultSet("select bin1,bin2 from bintest", true)) {
binTestResult(rs, allBytes);
}
}
@@ -641,7 +640,6 @@ private void binTestResult(ResultSet rs, byte[] allBytes) throws SQLException, I

assertEquals(new String(rs.getBytes(1), StandardCharsets.UTF_8), new String(allBytes, StandardCharsets.UTF_8));
assertEquals(new String(rs.getBytes(2), StandardCharsets.UTF_8), new String(allBytes, StandardCharsets.UTF_8));
assertEquals(rs.getString(3), new String(allBytes, StandardCharsets.UTF_8));

} else {
fail("Must have result !");

0 comments on commit be8e57f

Please sign in to comment.
You can’t perform that action at this time.