#[repr(u8)]pub enum Op {
Show 13 variants
Ping = 0,
Pong = 1,
Auth = 2,
AuthUser = 3,
Query = 16,
RowDescription = 17,
DataRow = 18,
CommandComplete = 19,
ErrorResponse = 20,
Stats = 21,
StatsResponse = 22,
DataRowBatch = 23,
Error = 255,
}Expand description
Wire opcodes (1 byte each). Numeric values are stable on the wire — never renumber an existing variant.
Variants§
Ping = 0
Pong = 1
Auth = 2
v1.14 client → server. Payload is the candidate password
(UTF-8 bytes). When the server is configured with a password,
the connection stays unauthenticated and refuses every other
opcode until Auth succeeds. A matching password gets a Pong
reply; a wrong one gets ErrorResponse.
AuthUser = 3
v4.1 client → server. Carries (username, password) for
per-user authentication. Layout:
[u16 user_len][user UTF-8][password UTF-8]. When the server
has a user table configured, this is the only auth that
works; legacy Op::Auth (password-only) still works in
single-password mode for backwards compatibility.
Query = 16
RowDescription = 17
DataRow = 18
CommandComplete = 19
ErrorResponse = 20
Stats = 21
StatsResponse = 22
DataRowBatch = 23
v3.3.0 server → client: many result rows packed into one frame.
Layout: [u16 row_count][u16 cell_count][per-cell WireValue]*.
cell_count is hoisted out (same for every row in the batch,
fixed by schema), saving 2 bytes / row vs sending a stream of
DataRow frames. The server only emits this for SELECTs with
more than one returned row — single-row paths still use DataRow
so a v3.2 / v3.1 client stays decodable.