MXS-2407 Report database for SHOW TABLES FROM db

The database used in 'SHOW TABLES FROM db' is now available via
qc_get_database_names().
This commit is contained in:
Johan Wikman
2019-03-25 16:56:14 +02:00
parent 8b4961261f
commit fe359593ba
2 changed files with 11 additions and 3 deletions

View File

@ -1848,14 +1848,14 @@ int32_t qc_mysql_get_database_names(GWBUF* querybuf, char*** databasesp, int* si
goto retblock; goto retblock;
} }
if (lex->describe || is_show_command(lex->sql_command)) if (lex->describe || (is_show_command(lex->sql_command) && !(lex->sql_command == SQLCOM_SHOW_TABLES)))
{ {
goto retblock; goto retblock;
} }
if (lex->sql_command == SQLCOM_CHANGE_DB) if (lex->sql_command == SQLCOM_CHANGE_DB || lex->sql_command == SQLCOM_SHOW_TABLES)
{ {
if (lex->select_lex.db) if (lex->select_lex.db && (strcmp(lex->select_lex.db, "skygw_virtual") != 0))
{ {
if (i >= currsz) if (i >= currsz)
{ {

View File

@ -3031,6 +3031,14 @@ public:
case MXS_SHOW_TABLES: case MXS_SHOW_TABLES:
m_type_mask = QUERY_TYPE_SHOW_TABLES; m_type_mask = QUERY_TYPE_SHOW_TABLES;
if (pShow->pDatabase->z)
{
char db[pShow->pDatabase->n + 1];
strncpy(db, pShow->pDatabase->z, pShow->pDatabase->n);
db[pShow->pDatabase->n] = 0;
update_database_names(db);
}
break; break;
case MXS_SHOW_VARIABLES: case MXS_SHOW_VARIABLES: