From 45bda0f72e5d542d109c1d87b0a72935351c1f24 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 21 Jun 2018 10:39:53 +0300 Subject: [PATCH] MXS-1936 Make qc_mysqlembedded compatible with qc_sqlite qc_mysqlembedded must also be updated to handle the new type QUERY_TYPE_DEALLOC_PREPARE. Some adjustements were also needed elsewhere. --- query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc | 2 +- query_classifier/test/classify.c | 4 ++++ server/core/query_classifier.cc | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index 07c813cf2..af7d5dbef 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -922,7 +922,7 @@ static uint32_t resolve_query_type(parsing_info_t *pi, THD* thd) break; case SQLCOM_DEALLOCATE_PREPARE: - type |= QUERY_TYPE_WRITE; + type |= QUERY_TYPE_DEALLOC_PREPARE; break; case SQLCOM_SELECT: diff --git a/query_classifier/test/classify.c b/query_classifier/test/classify.c index 7e977803a..21f1b2c86 100644 --- a/query_classifier/test/classify.c +++ b/query_classifier/test/classify.c @@ -140,6 +140,10 @@ char* get_types_as_string(uint32_t types) { s = append(s, "QUERY_TYPE_SHOW_TABLES", &len); } + if (types & QUERY_TYPE_DEALLOC_PREPARE) + { + s = append(s, "QUERY_TYPE_DEALLOC_PREPARE", &len); + } if (!s) { diff --git a/server/core/query_classifier.cc b/server/core/query_classifier.cc index 787abd21b..a493a4334 100644 --- a/server/core/query_classifier.cc +++ b/server/core/query_classifier.cc @@ -604,6 +604,14 @@ struct type_name_info type_to_type_name_info(qc_query_type_t type) } break; + case QUERY_TYPE_DEALLOC_PREPARE: + { + static const char name[] = "QUERY_TYPE_DEALLOC_PREPARE"; + info.name = name; + info.name_len = sizeof(name) - 1; + } + break; + default: { static const char name[] = "UNKNOWN_QUERY_TYPE"; @@ -650,6 +658,7 @@ static const qc_query_type_t QUERY_TYPES[] = QUERY_TYPE_READ_TMP_TABLE, QUERY_TYPE_SHOW_DATABASES, QUERY_TYPE_SHOW_TABLES, + QUERY_TYPE_DEALLOC_PREPARE, }; static const int N_QUERY_TYPES = sizeof(QUERY_TYPES) / sizeof(QUERY_TYPES[0]);