diff --git a/include/query_processor.h b/include/query_processor.h index 0ab309c10..4abe7019c 100644 --- a/include/query_processor.h +++ b/include/query_processor.h @@ -19,6 +19,7 @@ enum MYSQL_COM_QUERY_command { MYSQL_COM_QUERY_CREATE_TEMPORARY, MYSQL_COM_QUERY_CREATE_TRIGGER, MYSQL_COM_QUERY_CREATE_USER, + MYSQL_COM_QUERY_DEALLOCATE, MYSQL_COM_QUERY_DELETE, MYSQL_COM_QUERY_DESCRIBE, MYSQL_COM_QUERY_DROP_DATABASE, @@ -27,6 +28,7 @@ enum MYSQL_COM_QUERY_command { MYSQL_COM_QUERY_DROP_TRIGGER, MYSQL_COM_QUERY_DROP_USER, MYSQL_COM_QUERY_GRANT, + MYSQL_COM_QUERY_EXECUTE, MYSQL_COM_QUERY_EXPLAIN, MYSQL_COM_QUERY_FLUSH, MYSQL_COM_QUERY_INSERT, diff --git a/lib/Query_Processor.cpp b/lib/Query_Processor.cpp index 77986456c..9353876ef 100644 --- a/lib/Query_Processor.cpp +++ b/lib/Query_Processor.cpp @@ -308,6 +308,7 @@ Query_Processor::Query_Processor() { commands_counters_desc[MYSQL_COM_QUERY_CREATE_TEMPORARY]=(char *)"CREATE_TEMPORARY"; commands_counters_desc[MYSQL_COM_QUERY_CREATE_TRIGGER]=(char *)"CREATE_TRIGGER"; commands_counters_desc[MYSQL_COM_QUERY_CREATE_USER]=(char *)"CREATE_USER"; + commands_counters_desc[MYSQL_COM_QUERY_DEALLOCATE]=(char *)"DEALLOCATE"; commands_counters_desc[MYSQL_COM_QUERY_DELETE]=(char *)"DELETE"; commands_counters_desc[MYSQL_COM_QUERY_DESCRIBE]=(char *)"DESCRIBE"; commands_counters_desc[MYSQL_COM_QUERY_DROP_DATABASE]=(char *)"DROP_DATABASE"; @@ -316,6 +317,7 @@ Query_Processor::Query_Processor() { commands_counters_desc[MYSQL_COM_QUERY_DROP_TRIGGER]=(char *)"DROP_TRIGGER"; commands_counters_desc[MYSQL_COM_QUERY_DROP_USER]=(char *)"DROP_USER"; commands_counters_desc[MYSQL_COM_QUERY_GRANT]=(char *)"GRANT"; + commands_counters_desc[MYSQL_COM_QUERY_EXECUTE]=(char *)"EXECUTE"; commands_counters_desc[MYSQL_COM_QUERY_EXPLAIN]=(char *)"EXPLAIN"; commands_counters_desc[MYSQL_COM_QUERY_FLUSH]=(char *)"FLUSH"; commands_counters_desc[MYSQL_COM_QUERY_INSERT]=(char *)"INSERT"; @@ -1060,8 +1062,23 @@ enum MYSQL_COM_QUERY_command Query_Processor::__query_parser_command_type(SQP_pa break; case 'd': case 'D': + if (!strcasecmp("DEALLOCATE",token)) { // DEALLOCATE PREPARE + token=(char *)tokenize(&tok); + if (token==NULL) break; + if (!strcasecmp("PREPARE",token)) { + ret=MYSQL_COM_QUERY_DEALLOCATE; + break; + } + } if (!strcasecmp("DELETE",token)) { // DELETE ret=MYSQL_COM_QUERY_DELETE; + break; + } + break; + case 'e': + case 'E': + if (!strcasecmp("EXECUTE",token)) { // INSERT + ret=MYSQL_COM_QUERY_EXECUTE; } break; case 'i': @@ -1070,6 +1087,13 @@ enum MYSQL_COM_QUERY_command Query_Processor::__query_parser_command_type(SQP_pa ret=MYSQL_COM_QUERY_INSERT; } break; + case 'p': + case 'P': + if (!strcasecmp("PREPARE",token)) { // ROLLBACK + ret=MYSQL_COM_QUERY_PREPARE; + break; + } + break; case 'r': case 'R': if (!strcasecmp("REPLACE",token)) { // ROLLBACK diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index 0cf48dbd8..cf554b6cb 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -1196,6 +1196,11 @@ void MySQL_Connection::ProcessQueryAndSetStatusFlags(char *query_digest_text) { set_status_user_variable(true); } } + if (get_status_prepared_statement()==false) { // we search if prepared was already executed + if (!strncasecmp(query_digest_text,"PREPARE ", strlen("PREPARE "))) { + set_status_prepared_statement(true); + } + } if (get_status_temporary_table()==false) { // we search for temporary if not already set if (!strncasecmp(query_digest_text,"CREATE TEMPORARY TABLE ", strlen("CREATE TEMPORARY TABLE "))) { set_status_temporary_table(true);