From e3f0f1bb21bde13fad163b8ea96f2cbaf408ee92 Mon Sep 17 00:00:00 2001 From: onlyacat Date: Mon, 24 Jan 2022 16:11:00 +0800 Subject: [PATCH] Fix bug #106252. The client will handle EOF packet correctly. --- .../java/com/mysql/cj/ServerPreparedQuery.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/core-impl/java/com/mysql/cj/ServerPreparedQuery.java b/src/main/core-impl/java/com/mysql/cj/ServerPreparedQuery.java index a6d0e4114..a2a7efb15 100644 --- a/src/main/core-impl/java/com/mysql/cj/ServerPreparedQuery.java +++ b/src/main/core-impl/java/com/mysql/cj/ServerPreparedQuery.java @@ -159,17 +159,21 @@ public void serverPrepare(String sql) throws IOException { boolean checkEOF = !this.session.getServerSession().isEOFDeprecated(); if (this.parameterCount > 0) { + this.parameterFields = this.session.getProtocol().read(ColumnDefinition.class, new ColumnDefinitionFactory(this.parameterCount, null)) + .getFields(); + if (checkEOF) { // Skip the following EOF packet. this.session.getProtocol().skipPacket(); } - - this.parameterFields = this.session.getProtocol().read(ColumnDefinition.class, new ColumnDefinitionFactory(this.parameterCount, null)) - .getFields(); } // Read in the result set column information if (fieldCount > 0) { this.resultFields = this.session.getProtocol().read(ColumnDefinition.class, new ColumnDefinitionFactory(fieldCount, null)); + + if (checkEOF) { // Skip the following EOF packet. + this.session.getProtocol().skipPacket(); + } } } }