COM_STMT_EXECUTE
You are viewing an old version of this article. View
the current version here.
COM_STMT_EXECUTE
executes a previously prepared statement.
Direction
client to server
Fields
- int<1> 0x17 : COM_STMT_EXECUTE header
- int<4> statement id
- int<1> flags:
- int<4> Iteration count
- if (param_count > 0)
- if (Iteration count == 1)
- byte<(param_count + 7)/8> null bitmap
- byte<1> send_types_to_server (0 / 1)
- if (send_types_to_server)
- for each parameter :
- byte<2> parameter types
- for each parameter :
- for each iteration (i.e interation_count times)
- for each parameter (i.e param_count times)
- if (indicator_variable_used &&
extended_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)
- int<1> indicator_variable (0 = null value, 1 =default value)
- byte<n> binary parameter value
- if (indicator_variable_used &&
extended_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32)
- for each parameter (i.e param_count times)
- if (Iteration count == 1)
Flag
0 | no cursor |
1 | read only |
2 | cursor for update |
4 | scrollable cursor |
Parameter type
- byte<1> : field type
- byte<1> : parameter type flag
parameter type flag byte:
64 | indicator variable used (if extended_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS >> 32) |
128 | unsigned |
NULL-Bitmap
The NULL-Bitmap indicate if parameters are null (one bit per parameter).
NULL-bitmap size is (parameter number + 7) / 8
COM_STMT_EXECUTE response
server can answer with 3 differents responses :
- 0xff : ERR_Packet if any error occur
- 0x00 :OK_packet when query execution works without resultset
- Or a Resultset, when query execution works with resultset (in case of SELECT query for example)
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.