Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CONJ-528] remove limitation max_allowed_packet size for LOAD DATA LO…
…CAL INFILE command
  • Loading branch information
rusher committed Sep 21, 2017
1 parent 9b2f332 commit 0f0c2d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Expand Up @@ -1262,16 +1262,15 @@ public void readLocalInfilePacket(Buffer buffer, Results results) throws SQLExce
}

try {
writer.startPacket(seq);
writer.write(is, false, false);
writer.flush();

byte[] buf = new byte[8192];
int len;
while ((len = is.read(buf)) > 0) {
writer.startPacket(seq++);
writer.write(buf, 0, len);
writer.flush();
}
writer.writeEmptyPacket();
} catch (MaxAllowedPacketException ioe) {
//particular case : error has been throw before sending packets.
//must finished exchanges before throwing error
writer.writeEmptyPacket(seq++);
reader.getPacket(true);
throw handleIoException(ioe);

} catch (IOException ioe) {
throw handleIoException(ioe);
Expand Down
Expand Up @@ -303,12 +303,7 @@ public void test2xMaxAllowedPacketLocalInfileInputStream() throws Exception {
ResultSet rs = sharedConnection.createStatement().executeQuery("select @@max_allowed_packet");
rs.next();
long maxAllowedPacket = rs.getLong(1);
try {
checkBigLocalInfile(maxAllowedPacket * 2);
fail("must have fail");
} catch (SQLException sqle) {
assertTrue(sqle.getMessage().contains("Could not send query: query size is >= to max_allowed_packet"));
}
checkBigLocalInfile(maxAllowedPacket * 2);
}

}

0 comments on commit 0f0c2d8

Please sign in to comment.