MXS-1625 Remove need for RWS session in check_create_tmp_table
This commit is contained in:
@ -151,6 +151,11 @@ public:
|
|||||||
|
|
||||||
uint32_t get_route_target(uint8_t command, uint32_t qtype);
|
uint32_t get_route_target(uint8_t command, uint32_t qtype);
|
||||||
|
|
||||||
|
MXS_SESSION* session()
|
||||||
|
{
|
||||||
|
return m_pSession;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PSManager;
|
class PSManager;
|
||||||
typedef std::shared_ptr<PSManager> SPSManager;
|
typedef std::shared_ptr<PSManager> SPSManager;
|
||||||
|
|||||||
@ -217,32 +217,28 @@ uint32_t determine_query_type(GWBUF *querybuf, int command)
|
|||||||
* the database and table name, create a hashvalue and
|
* the database and table name, create a hashvalue and
|
||||||
* add it to the router client session's property. If property
|
* add it to the router client session's property. If property
|
||||||
* doesn't exist then create it first.
|
* doesn't exist then create it first.
|
||||||
* @param router_cli_ses Router client session
|
* @param qc The query classifier.
|
||||||
* @param querybuf GWBUF containing the query
|
* @param querybuf GWBUF containing the query
|
||||||
* @param type The type of the query resolved so far
|
* @param type The type of the query resolved so far
|
||||||
*/
|
*/
|
||||||
void check_create_tmp_table(RWSplitSession *router_cli_ses,
|
void check_create_tmp_table(QueryClassifier& qc, GWBUF *querybuf, uint32_t type)
|
||||||
GWBUF *querybuf, uint32_t type)
|
|
||||||
{
|
{
|
||||||
if (qc_query_is_type(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
if (qc_query_is_type(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||||
{
|
{
|
||||||
ss_dassert(router_cli_ses && querybuf && router_cli_ses->m_client &&
|
qc.set_have_tmp_tables(true);
|
||||||
router_cli_ses->m_client->data);
|
|
||||||
|
|
||||||
router_cli_ses->qc().set_have_tmp_tables(true);
|
|
||||||
char* tblname = qc_get_created_table_name(querybuf);
|
char* tblname = qc_get_created_table_name(querybuf);
|
||||||
std::string table;
|
std::string table;
|
||||||
|
|
||||||
if (tblname && *tblname && strchr(tblname, '.') == NULL)
|
if (tblname && *tblname && strchr(tblname, '.') == NULL)
|
||||||
{
|
{
|
||||||
const char* db = mxs_mysql_get_current_db(router_cli_ses->m_client->session);
|
const char* db = mxs_mysql_get_current_db(qc.session());
|
||||||
table += db;
|
table += db;
|
||||||
table += ".";
|
table += ".";
|
||||||
table += tblname;
|
table += tblname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add the table to the set of temporary tables */
|
/** Add the table to the set of temporary tables */
|
||||||
router_cli_ses->qc().add_tmp_table(table);
|
qc.add_tmp_table(table);
|
||||||
|
|
||||||
MXS_FREE(tblname);
|
MXS_FREE(tblname);
|
||||||
}
|
}
|
||||||
@ -485,7 +481,7 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_create_tmp_table(rses, querybuf, *qtype);
|
check_create_tmp_table(rses->qc(), querybuf, *qtype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this is a LOAD DATA LOCAL INFILE query. If so, send all queries
|
* Check if this is a LOAD DATA LOCAL INFILE query. If so, send all queries
|
||||||
|
|||||||
Reference in New Issue
Block a user