From 83fdfc0343d25613d3df11a95c08096955c37068 Mon Sep 17 00:00:00 2001 From: rusher Date: Tue, 29 Aug 2017 15:30:48 +0200 Subject: [PATCH] [CONJ-517] report test for Result-set identification of OK_Packet with 0xFE header when using option useCompression --- .../java/org/mariadb/jdbc/BigQueryTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/test/java/org/mariadb/jdbc/BigQueryTest.java b/src/test/java/org/mariadb/jdbc/BigQueryTest.java index 1fe0eb64f..1aed4fc36 100644 --- a/src/test/java/org/mariadb/jdbc/BigQueryTest.java +++ b/src/test/java/org/mariadb/jdbc/BigQueryTest.java @@ -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 @@ -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 {