Implement COM_MULTI protocol command. Just as COM_QUERY support multiple queries in one packet, COM_MULTI will bundle many COM_xxx commands in one packet.
May be the server should only support COM_MULTI if CLIENT_MULTI_RESULTS flag is set? Probably not
Packets included in one COM_MULTI probably do not need packet number as well as separate compression, so only 3 bytes of length for each.
For prepared statement to be able prepare / execute / deallocate the command in one COM_MULTI batch will be special prepared statement ID (0 or -1) which mean ID of previous command.
- 4 or 7 bytes: of packet header (read by my_real_read())
- 1 byte: COM_MULTI
- 3 bytes: length of subcommand 1
- N1 bytes: subcommand1
- 3 bytes: length of subcommand 2
- N2 bytes: subcommand 2
- 3 bytes: length of subcommand m
- Nm bytes: subcommand m
COM_MULTI should be numbered from the "end" i.e. 255
There should be capability flag for it.