From 65df87d801d9debac152deb1ab6eb0654dac816a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 19 Jun 2017 15:27:14 +0300 Subject: [PATCH] Update query operation enum and add EXECUTE Changed the query operation enum to contain implicit enum values instead of providing. The operation was never used as a bitmask so it is pointless to declare them as such. Added the EXECUTE type to the enum and used it in qc_sqlite and qc_mysqlembedded. --- include/maxscale/query_classifier.h | 27 ++++++++++--------- .../qc_mysqlembedded/qc_mysqlembedded.cc | 4 +++ query_classifier/qc_sqlite/qc_sqlite.c | 1 + 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/maxscale/query_classifier.h b/include/maxscale/query_classifier.h index 0d4b91800..d64ddf824 100644 --- a/include/maxscale/query_classifier.h +++ b/include/maxscale/query_classifier.h @@ -82,19 +82,20 @@ typedef enum qc_query_type */ typedef enum qc_query_op { - QUERY_OP_UNDEFINED = 0, - QUERY_OP_SELECT = (1 << 0), - QUERY_OP_UPDATE = (1 << 1), - QUERY_OP_INSERT = (1 << 2), - QUERY_OP_DELETE = (1 << 3), - QUERY_OP_TRUNCATE = (1 << 4), - QUERY_OP_ALTER = (1 << 5), - QUERY_OP_CREATE = (1 << 6), - QUERY_OP_DROP = (1 << 7), - QUERY_OP_CHANGE_DB = (1 << 8), - QUERY_OP_LOAD = (1 << 9), - QUERY_OP_GRANT = (1 << 10), - QUERY_OP_REVOKE = (1 << 11) + QUERY_OP_UNDEFINED = 0, + QUERY_OP_SELECT, + QUERY_OP_UPDATE, + QUERY_OP_INSERT, + QUERY_OP_DELETE, + QUERY_OP_TRUNCATE, + QUERY_OP_ALTER, + QUERY_OP_CREATE, + QUERY_OP_DROP, + QUERY_OP_CHANGE_DB, + QUERY_OP_LOAD, + QUERY_OP_GRANT, + QUERY_OP_REVOKE, + QUERY_OP_EXECUTE, } qc_query_op_t; /** diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index a5ef760bd..467456079 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -1745,6 +1745,10 @@ int32_t qc_mysql_get_operation(GWBUF* querybuf, int32_t* operation) *operation = QUERY_OP_REVOKE; break; + case SQLCOM_EXECUTE: + *operation = QUERY_OP_EXECUTE; + break; + default: *operation = QUERY_OP_UNDEFINED; } diff --git a/query_classifier/qc_sqlite/qc_sqlite.c b/query_classifier/qc_sqlite/qc_sqlite.c index 0cfe41610..f9dfa289a 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.c +++ b/query_classifier/qc_sqlite/qc_sqlite.c @@ -2032,6 +2032,7 @@ void maxscaleExecute(Parse* pParse, Token* pName) info->status = QC_QUERY_PARSED; info->type_mask = QUERY_TYPE_WRITE; + info->operation = QUERY_OP_EXECUTE; // If information is collected in several passes, then we may // this information already.