From 3c6a323adafd39873a8158c2a2516e4ec8a0ab80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 28 May 2017 16:40:12 +0200 Subject: [PATCH] Admin to support SELECT DATABASE() AS name #1022 --- lib/ProxySQL_Admin.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index e7bae0fad..4cf07ab2c 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -2121,6 +2121,18 @@ __end_show_commands: goto __run_query; } + // see issue #1022 + if (query_no_space_length==strlen("SELECT DATABASE() AS name") && !strncasecmp("SELECT DATABASE() AS name",query_no_space, query_no_space_length)) { + l_free(query_length,query); + if (sess->stats==false) { + query=l_strdup("SELECT \"admin\" AS 'name'"); + } else { + query=l_strdup("SELECT \"stats\" AS 'name'"); + } + query_length=strlen(query)+1; + goto __run_query; + } + if (sess->stats==true) { if ( (strncasecmp("PRAGMA",query_no_space,6)==0)