From c11ffd91c5dc7c31a65a2184780a85db071f8220 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Aug 2017 10:38:51 +0300 Subject: [PATCH] MXS-1349 Access right field when picking out preparable stmt The preparable statement is stored in two fields; in one in full and in another at most 255 chars. --- query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index 2879de849..72ef4f978 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -35,6 +35,10 @@ #include #include #include +// We need to get access to Item::str_value, which is protected. So we cheat. +#define protected public +#include +#undef protected #include #include #include @@ -2086,8 +2090,8 @@ int32_t qc_mysql_get_preparable_stmt(GWBUF* stmt, GWBUF** preparable_stmt) const char* preparable_stmt; size_t preparable_stmt_len; #if MYSQL_VERSION_MINOR >= 3 - preparable_stmt = lex->prepared_stmt_code->name.str; - preparable_stmt_len = lex->prepared_stmt_code->name.length; + preparable_stmt = lex->prepared_stmt_code->str_value.ptr(); + preparable_stmt_len = lex->prepared_stmt_code->str_value.length(); #else preparable_stmt = lex->prepared_stmt_code.str; preparable_stmt_len = lex->prepared_stmt_code.length;