Merge branch '2.3' into develop

This commit is contained in:
Johan Wikman
2019-02-22 12:22:11 +02:00
2 changed files with 67 additions and 36 deletions

View File

@ -1853,6 +1853,29 @@ int32_t qc_mysql_get_database_names(GWBUF* querybuf, char*** databasesp, int* si
goto retblock;
}
if (lex->sql_command == SQLCOM_CHANGE_DB)
{
if (lex->select_lex.db)
{
if (i >= currsz)
{
tmp = (char**) realloc(databases,
sizeof(char*) * (currsz * 2 + 1));
if (tmp == NULL)
{
goto retblock;
}
databases = tmp;
currsz = currsz * 2 + 1;
}
databases[i++] = strdup(lex->select_lex.db);
}
}
else
{
lex->current_select = lex->all_selects_list;
while (lex->current_select)
@ -1906,6 +1929,7 @@ int32_t qc_mysql_get_database_names(GWBUF* querybuf, char*** databasesp, int* si
lex->current_select = lex->current_select->next_select_in_list();
}
}
retblock:
*size = i;

View File

@ -3046,6 +3046,13 @@ public:
m_status = QC_QUERY_PARSED;
m_type_mask = QUERY_TYPE_SESSION_WRITE;
m_operation = QUERY_OP_CHANGE_DB;
if (should_collect(QC_COLLECT_DATABASES))
{
char* zCopy = MXS_STRNDUP_A(pToken->z, pToken->n);
m_database_names.push_back(zCopy);
}
}
void set_type_mask(uint32_t type_mask)