Skip to content

Commit

Permalink
[CONJ-517] report test for Result-set identification of OK_Packet wit…
Browse files Browse the repository at this point in the history
…h 0xFE header when using option useCompression
  • Loading branch information
rusher committed Aug 29, 2017
1 parent cabb917 commit 83fdfc0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/java/org/mariadb/jdbc/BigQueryTest.java
Expand Up @@ -78,6 +78,7 @@ public static void initClass() throws SQLException {
createTable("bigblob3", "id int not null primary key auto_increment, test longblob, test2 longblob, test3 varchar(20)");
createTable("bigblob4", "test longblob");
createTable("bigblob5", "id int not null primary key auto_increment, test longblob, test2 text");
createTable("bigblob6", "id int not null primary key auto_increment, test longblob");
}

@Test
Expand Down Expand Up @@ -105,6 +106,31 @@ public void sendBigQuery2() throws SQLException {
}
}

@Test
public void sendBigPreparedQueryFe() throws SQLException {

Assume.assumeTrue(checkMaxAllowedPacketMore20m("sendBigPreparedQueryFe"));

byte[] arr = new byte[20000000];
Arrays.fill(arr, (byte) 0xfe);
try (Connection connection = setConnection("&useCompression=true")) {
PreparedStatement ps = connection.prepareStatement("insert into bigblob6 values(null, ?)");
ps.setBytes(1, arr);
ps.executeUpdate();
ps.setBytes(1, arr);
ps.executeUpdate();

Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select test from bigblob6");
rs.next();
byte[] newBytes = rs.getBytes(1);
assertEquals(arr.length, newBytes.length);
for (int i = 0; i < arr.length; i++) {
assertEquals(arr[i], newBytes[i]);
}
}
}

@Test
public void sendBigPreparedQuery() throws SQLException {

Expand Down

0 comments on commit 83fdfc0

Please sign in to comment.