Skip to content

Commit

Permalink
[fix](jdbc) fix Unknown command(27) (#41621)
Browse files Browse the repository at this point in the history
fix #35980
  • Loading branch information
mymeiyi authored Oct 10, 2024
1 parent 0d2550f commit 469f04e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public enum MysqlCommand {
COM_STMT_SEND_LONG_DATA("COM_STMT_SEND_LONG_DATA", 24),
COM_STMT_CLOSE("COM_STMT_CLOSE", 25),
COM_STMT_RESET("COM_STMT_RESET", 26),
COM_SET_OPTION("COM_RESET_CONNECTION", 27),
COM_STMT_FETCH("COM_RESET_CONNECTION", 28),
COM_SET_OPTION("COM_SET_OPTION", 27),
COM_STMT_FETCH("COM_STMT_FETCH", 28),
COM_DAEMON("COM_DAEMON", 29),
COM_RESET_CONNECTION("COM_RESET_CONNECTION", 31);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ private void dispatch() throws IOException {
case COM_STMT_CLOSE:
handleStmtClose();
break;
case COM_SET_OPTION:
handleSetOption();
break;
default:
ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")");
LOG.warn("Unsupported command(" + command + ")");
Expand Down Expand Up @@ -369,6 +372,15 @@ private void handleChangeUser() throws IOException {
ctx.getState().setOk();
}

private void handleSetOption() {
// https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_set_option.html
int optionOperation = MysqlProto.readInt2(packetBuf);
LOG.debug("option_operation {}", optionOperation);
// Do nothing for now.
// https://dev.mysql.com/doc/c-api/8.0/en/mysql-set-server-option.html
ctx.getState().setOk();
}

// Process a MySQL request
public void processOnce() throws IOException {
// set status of query to OK.
Expand Down

0 comments on commit 469f04e

Please sign in to comment.