Skip to content

Commit

Permalink
Add support in Admin for SHOW TABLES IN #2478
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Jan 9, 2020
1 parent 5a34686 commit 1d2e059
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/ProxySQL_Admin.cpp
Expand Up @@ -3933,6 +3933,21 @@ void admin_session_handler(MySQL_Session *sess, void *_pa, PtrSize_t *pkt) {
goto __run_query;
}

if ((query_no_space_length>15) && (!strncasecmp("SHOW TABLES IN ", query_no_space, 15))) {
strA=query_no_space+15;
strAl=strlen(strA);
strB=(char *)"SELECT name AS tables FROM %s.sqlite_master WHERE type='table' AND name NOT IN ('sqlite_sequence') ORDER BY name";
strBl=strlen(strB);
int l=strBl+strAl-2;
char *b=(char *)l_alloc(l+1);
snprintf(b,l+1,strB,strA);
b[l]=0;
l_free(query_length,query);
query=b;
query_length=l+1;
goto __run_query;
}

if ((query_no_space_length>17) && (!strncasecmp("SHOW TABLES FROM ", query_no_space, 17))) {
strA=query_no_space+17;
strAl=strlen(strA);
Expand Down

0 comments on commit 1d2e059

Please sign in to comment.