MXS-852: Use stored query type for COM_STMT_EXECUTE

When a COM_STMT_EXECUTE or a COM_STMT_SEND_LONG_DATA command is executed,
the query type of the prepared statement is used. This allows read-only
prepared statements to be load balanced across slaves.
This commit is contained in:
Markus Mäkelä
2017-06-21 16:27:31 +03:00
parent 77f78c4b20
commit 3c4e1e3b4b
6 changed files with 61 additions and 31 deletions

View File

@ -537,12 +537,14 @@ uint8_t mxs_mysql_get_command(GWBUF* buffer);
bool mxs_mysql_extract_ps_response(GWBUF* buffer, MXS_PS_RESPONSE* out);
/**
* @brief Extract the ID of a COM_STMT_EXECUTE
* @brief Extract the ID from a COM_STMT command
*
* @param buffer Buffer containing a COM_STMT_EXECUTE packet
* All the COM_STMT type commands store the statement ID in the same place.
*
* @return The ID of the prepared statement being executed or 0 on failure
* @param buffer Buffer containing one of the COM_STMT commands (not COM_STMT_PREPARE)
*
* @return The statement ID
*/
uint32_t mxs_mysql_extract_execute(GWBUF* buffer);
uint32_t mxs_mysql_extract_ps_id(GWBUF* buffer);
MXS_END_DECLS