QC: Parse statements in COM_STMT_PREPARE packets

This commit is contained in:
Johan Wikman
2017-01-17 16:00:37 +02:00
parent f7892843b5
commit ded9f668f1
2 changed files with 41 additions and 28 deletions

View File

@ -507,7 +507,9 @@ static bool parse_query(GWBUF* query)
if ((GWBUF_LENGTH(query) >= MYSQL_HEADER_LEN + 1) &&
(GWBUF_LENGTH(query) == MYSQL_HEADER_LEN + MYSQL_GET_PAYLOAD_LEN(data)))
{
if (MYSQL_GET_COMMAND(data) == MYSQL_COM_QUERY)
uint8_t command = MYSQL_GET_COMMAND(data);
if ((command == MYSQL_COM_QUERY) || (command == MYSQL_COM_STMT_PREPARE))
{
QC_SQLITE_INFO* info = info_alloc();
@ -525,6 +527,11 @@ static bool parse_query(GWBUF* query)
this_thread.info->query = NULL;
this_thread.info->query_len = 0;
if (command == MYSQL_COM_STMT_PREPARE)
{
info->types |= QUERY_TYPE_PREPARE_STMT;
}
// TODO: Add return value to gwbuf_add_buffer_object.
// Always added; also when it was not recognized. If it was not recognized now,
// it won't be if we try a second time.