MXS-2103: Fix CREATE TEMPORARY TABLE detection
The table creation was not detected as the function used to extract the table name did not return the fully qualified names. Even if it did return a fully qualified name, it wouldn't have been correctly processed.
This commit is contained in:
@ -169,20 +169,36 @@ void check_create_tmp_table(RWSplitSession *router_cli_ses,
|
||||
router_cli_ses->client_dcb->data);
|
||||
|
||||
router_cli_ses->have_tmp_tables = true;
|
||||
char* tblname = qc_get_created_table_name(querybuf);
|
||||
int size = 0;
|
||||
char** tblname = qc_get_table_names(querybuf, &size, true);
|
||||
std::string table;
|
||||
|
||||
if (tblname && *tblname && strchr(tblname, '.') == NULL)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
const char* db = mxs_mysql_get_current_db(router_cli_ses->client_dcb->session);
|
||||
table += db;
|
||||
table += ".";
|
||||
table += tblname;
|
||||
if (tblname[i] && *tblname[i])
|
||||
{
|
||||
table = tblname[i];
|
||||
|
||||
if (strchr(tblname[i], '.') == NULL)
|
||||
{
|
||||
const char* db = mxs_mysql_get_current_db(router_cli_ses->client_dcb->session);
|
||||
table = db;
|
||||
table += ".";
|
||||
table += tblname[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MXS_INFO("Added temporary table %s", table.c_str());
|
||||
|
||||
/** Add the table to the set of temporary tables */
|
||||
router_cli_ses->temp_tables.insert(table);
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
MXS_FREE(tblname[i]);
|
||||
}
|
||||
MXS_FREE(tblname);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user