Documentation Home
MySQL Internals Manual


COM_STMT_PREPARE creates a prepared statement from the passed query string.

The server returns a COM_STMT_PREPARE Response which contains a statement-id which is used to identify the prepared statement.


create a prepared statement

  • command (1) -- [16] the COM_STMT_PREPARE command

  • query (string.EOF) -- the query to prepare

1c 00 00 00 16 53 45 4c    45 43 54 20 43 4f 4e 43    .....SELECT CONC
41 54 28 3f 2c 20 3f 29    20 41 53 20 63 6f 6c 31    AT(?, ?) AS col1
Implemented By



COM_STMT_PREPARE_OK on success, ERR_Packet otherwise


As LOAD DATA isn't supported by COM_STMT_PREPARE yet, no Protocol::LOCAL_INFILE_Request is expected here. Compare this to COM_QUERY_Response.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.