diff --git a/server/modules/routing/maxinfo/maxinfo.c b/server/modules/routing/maxinfo/maxinfo.c index 04523d044..bd1ac2bbe 100644 --- a/server/modules/routing/maxinfo/maxinfo.c +++ b/server/modules/routing/maxinfo/maxinfo.c @@ -63,7 +63,7 @@ static int maxinfo_statistics(INFO_INSTANCE *, INFO_SESSION *, GWBUF *); static int maxinfo_ping(INFO_INSTANCE *, INFO_SESSION *, GWBUF *); static int maxinfo_execute_query(INFO_INSTANCE *, INFO_SESSION *, char *); static int handle_url(INFO_INSTANCE *instance, INFO_SESSION *router_session, GWBUF *queue); - +static int maxinfo_send_ok(DCB *dcb); /* The router entry points */ static MXS_ROUTER *createInstance(SERVICE *service, char **options); @@ -348,7 +348,7 @@ execute(MXS_ROUTER *rinstance, MXS_ROUTER_SESSION *router_session, GWBUF *queue) switch (MYSQL_COMMAND(queue)) { case MXS_COM_PING: - rc = maxinfo_ping(instance, session, queue); + rc = maxinfo_send_ok(session->dcb); break; case MXS_COM_STATISTICS: rc = maxinfo_statistics(instance, session, queue); @@ -622,7 +622,7 @@ maxinfo_execute_query(INFO_INSTANCE *instance, INFO_SESSION *session, char *sql) respond_starttime(session->dcb); return 1; } - if (strcasecmp(sql, "set names 'utf8'") == 0) + if (strncasecmp(sql, "set names", 9) == 0) { return maxinfo_send_ok(session->dcb); } @@ -630,6 +630,10 @@ maxinfo_execute_query(INFO_INSTANCE *instance, INFO_SESSION *session, char *sql) { return maxinfo_send_ok(session->dcb); } + if (strncasecmp(sql, "set @@session", 13) == 0) + { + return maxinfo_send_ok(session->dcb); + } if (strncasecmp(sql, "set autocommit", 14) == 0) { return maxinfo_send_ok(session->dcb); diff --git a/server/modules/routing/maxinfo/maxinfo_exec.c b/server/modules/routing/maxinfo/maxinfo_exec.c index a1d49ce11..ba7af2a11 100644 --- a/server/modules/routing/maxinfo/maxinfo_exec.c +++ b/server/modules/routing/maxinfo/maxinfo_exec.c @@ -353,6 +353,13 @@ exec_flush(DCB *dcb, MAXINFO_TREE *tree) { int i; char errmsg[120]; + sprintf(errmsg, "Unsupported flush command '%s'", tree->value); + + if(!tree) { + maxinfo_send_error(dcb, 0, errmsg); + MXS_ERROR("%s", errmsg); + return; + } for (i = 0; flush_commands[i].name; i++) { @@ -366,7 +373,7 @@ exec_flush(DCB *dcb, MAXINFO_TREE *tree) { tree->value[80] = 0; } - sprintf(errmsg, "Unsupported flush command '%s'", tree->value); + maxinfo_send_error(dcb, 0, errmsg); MXS_ERROR("%s", errmsg); }