Command packet

A Command packet is used for almost all the MySQL commands available, namely:

  • BINLOG_DUMP

  • BINLOG_DUMPGTID

  • CHANGE_USER

  • CONNECT

  • CONNECT_OUT

  • CREATE_DB

  • DAEMON

  • DEBUG

  • DELAYED_INSERT

  • DROP_DB

  • FIELD_LIST

  • INIT_DB

  • PING

  • PROCESS_INFO

  • PROCESS_KILL

  • QUERY

  • QUIT

  • REFRESH

  • REGISTER_SLAVE

  • RESET_CONNECTION

  • SEND_LONG_DATA

  • SET_OPTION

  • SHUTDOWN

  • SLEEP

  • STATS

  • STMT_CLOSE

  • STMT_FETCH

  • STMT_PREPARE

  • STMT_RESET

  • TABLE_DUMP

  • TIME

Properties

  • int sequenceId: the sequence ID for the packet.

  • String packetType: always "Command" - read-only.

  • int commandType: the numeric code for the type of command

  • String commandTypeName: the name of the command type -- one of the names listed above. Read-only: use commandType to change.

  • String s1: the first string parameter for the command, if any

  • String s2: the second string parameter for the command, if any

  • int num1: the first number parameter for the command, if any

  • int num2: the second number parameter for the command, if any

  • String query: the query. Only valid for command type=QUERY. This is actually an alias for s1.


This is the most common type of request sent by the client. Most of the commands are considered obsolete but still supported by many MySQL implementations.

QUERY, STMT_PREPARE, STMT_FETCH, STMT_RESET and STMT_CLOSE are the most frequent commands.

The STMT_EXECUTE command is implemented by its own packet type (StmtExecute).