![]() |
MySQL 8.0.43
Source Code Documentation
|
Creates a prepared statement for the passed query string.
The server returns a COM_STMT_PREPARE Response which contains a statement-id which is ised to identify the prepared statement.
| Type | Name | Description |
|---|---|---|
| int<1> | command | 0x16: COM_STMT_PREPARE |
| string<EOF> | query | The query to prepare |
If COM_STMT_PREPARE succeeded, it sends a COM_STMT_PREPARE_OK
| Type | Name | Description |
|---|---|---|
| int<1> | status | 0x00: OK: Ignored by cli_read_prepare_result |
| int<4> | statement_id | statement ID |
| int<2> | num_columns | Number of columns |
| int<2> | num_params | Number of parameters |
| int<1> | reserved_1 | [00] filler |
| if (packet_lenght > 12) { | ||
| int<2> | warning_count | Number of warnings |
| if capabilities & CLIENT_OPTIONAL_RESULTSET_METADATA { | ||
| int<1> | metadata_follows | Flag specifying if metadata are skipped or not. See enum_resultset_metadata |
| } – CLIENT_OPTIONAL_RESULTSET_METADATA { | ||
| } – packet_lenght > 12 | ||
if num_params > 0 and CLIENT_OPTIONAL_RESULTSET_METADATA is not set or if medatdata_follows is RESULTSET_METADATA_FULL num_params packets will follow. Then a EOF_Packet will be transmitted, provided that CLIENT_DEPRECATE_EOF is not set.
| Type | Name | Description |
|---|---|---|
num_params * Column Definition | ||
| if (not capabilities & CLIENT_DEPRECATE_EOF) { | ||
| EOF_Packet | ||
| } –CLIENT_DEPRECATE_EOF | ||
if num_columns > 0 and CLIENT_OPTIONAL_RESULTSET_METADATA is not set or if medatdata_follows is RESULTSET_METADATA_FULL num_columns packets will follow. Then a EOF_Packet will be transmitted, provided that CLIENT_DEPRECATE_EOF is not set.
| Type | Name | Description |
|---|---|---|
num_columns * Column Definition | ||
| if (not capabilities & CLIENT_DEPRECATE_EOF) { | ||
| EOF_Packet | ||
| } –CLIENT_DEPRECATE_EOF | ||