|
I think this is already the case: qc_get_type_mask for a COM_STMT_PREPARE is identical to the COM_QUERY version of the query with the exception that it has the QUERY_TYPE_PREPARE_STMT bit set. This means that the type of the statement being prepared can be extracted by ignoring the QUERY_TYPE_PREPARE_STMT bit.
This translates to:
GWBUF *pBuf = ...;
|
uint32_t type_mask = qc_get_type_mask(pBuf);
|
type_mask &= ~(QUERY_TYPE_PREPARE_NAMED_STMT|QUERY_TYPE_PREPARE_STMT);
|
A convenient helper function could be added for this.
|