Rename qc_get_type() to qc_get_type_mask()
To make it plain that it is a mask that is returned and not a specific value from the enum qc_query_type_t.
This commit is contained in:
@ -133,14 +133,14 @@ qc_parse_result_t qc_parse(GWBUF* query)
|
||||
return (qc_parse_result_t)result;
|
||||
}
|
||||
|
||||
uint32_t qc_get_type(GWBUF* query)
|
||||
uint32_t qc_get_type_mask(GWBUF* query)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
uint32_t type_mask = QUERY_TYPE_UNKNOWN;
|
||||
|
||||
classifier->qc_get_type(query, &type_mask);
|
||||
classifier->qc_get_type_mask(query, &type_mask);
|
||||
|
||||
return type_mask;
|
||||
}
|
||||
|
@ -2337,7 +2337,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
|
||||
if (modutil_is_SQL(queue) || modutil_is_SQL_prepare(queue))
|
||||
{
|
||||
type = qc_get_type(queue);
|
||||
type = qc_get_type_mask(queue);
|
||||
}
|
||||
|
||||
if (modutil_is_SQL(queue) && modutil_count_statements(queue) > 1)
|
||||
|
@ -127,14 +127,14 @@ static int id_gen(lua_State* state)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_qc_get_type(lua_State* state)
|
||||
static int lua_qc_get_type_mask(lua_State* state)
|
||||
{
|
||||
int ibuf = lua_upvalueindex(1);
|
||||
GWBUF *buf = *((GWBUF**)lua_touserdata(state, ibuf));
|
||||
|
||||
if (buf)
|
||||
{
|
||||
uint32_t type = qc_get_type(buf);
|
||||
uint32_t type = qc_get_type_mask(buf);
|
||||
char *mask = qc_typemask_to_string(type);
|
||||
lua_pushstring(state, mask);
|
||||
MXS_FREE(mask);
|
||||
@ -243,8 +243,8 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params)
|
||||
|
||||
/** Expose a part of the query classifier API */
|
||||
lua_pushlightuserdata(my_instance->global_lua_state, ¤t_global_query);
|
||||
lua_pushcclosure(my_instance->global_lua_state, lua_qc_get_type, 1);
|
||||
lua_setglobal(my_instance->global_lua_state, "lua_qc_get_type");
|
||||
lua_pushcclosure(my_instance->global_lua_state, lua_qc_get_type_mask, 1);
|
||||
lua_setglobal(my_instance->global_lua_state, "lua_qc_get_type_mask");
|
||||
|
||||
lua_pushlightuserdata(my_instance->global_lua_state, ¤t_global_query);
|
||||
lua_pushcclosure(my_instance->global_lua_state, lua_qc_get_operation, 1);
|
||||
@ -314,8 +314,8 @@ static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session
|
||||
|
||||
/** Expose a part of the query classifier API */
|
||||
lua_pushlightuserdata(my_session->lua_state, &my_session->current_query);
|
||||
lua_pushcclosure(my_session->lua_state, lua_qc_get_type, 1);
|
||||
lua_setglobal(my_session->lua_state, "lua_qc_get_type");
|
||||
lua_pushcclosure(my_session->lua_state, lua_qc_get_type_mask, 1);
|
||||
lua_setglobal(my_session->lua_state, "lua_qc_get_type_mask");
|
||||
|
||||
lua_pushlightuserdata(my_session->lua_state, &my_session->current_query);
|
||||
lua_pushcclosure(my_session->lua_state, lua_qc_get_operation, 1);
|
||||
|
@ -439,7 +439,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
|
||||
{
|
||||
if ((ptr = modutil_get_SQL(queue)) != NULL)
|
||||
{
|
||||
uint32_t query_type = qc_get_type(queue);
|
||||
uint32_t query_type = qc_get_type_mask(queue);
|
||||
int query_len = strlen(ptr);
|
||||
my_session->query_end = false;
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
|
||||
|
||||
if (MYSQL_GET_COMMAND(data) == MYSQL_COM_QUERY)
|
||||
{
|
||||
uint32_t type = qc_get_type(packetbuf);
|
||||
uint32_t type = qc_get_type_mask(packetbuf);
|
||||
|
||||
if (type & QUERY_TYPE_BEGIN_TRX)
|
||||
{
|
||||
|
@ -392,11 +392,11 @@ determine_query_type(GWBUF *querybuf, int packet_type, bool non_empty_packet)
|
||||
break;
|
||||
|
||||
case MYSQL_COM_QUERY:
|
||||
qtype = qc_get_type(querybuf);
|
||||
qtype = qc_get_type_mask(querybuf);
|
||||
break;
|
||||
|
||||
case MYSQL_COM_STMT_PREPARE:
|
||||
qtype = qc_get_type(querybuf);
|
||||
qtype = qc_get_type_mask(querybuf);
|
||||
qtype |= QUERY_TYPE_PREPARE_STMT;
|
||||
break;
|
||||
|
||||
|
@ -1765,12 +1765,12 @@ static int routeQuery(ROUTER* instance,
|
||||
break;
|
||||
|
||||
case MYSQL_COM_QUERY:
|
||||
qtype = qc_get_type(querybuf);
|
||||
qtype = qc_get_type_mask(querybuf);
|
||||
op = qc_get_operation(querybuf);
|
||||
break;
|
||||
|
||||
case MYSQL_COM_STMT_PREPARE:
|
||||
qtype = qc_get_type(querybuf);
|
||||
qtype = qc_get_type_mask(querybuf);
|
||||
qtype |= QUERY_TYPE_PREPARE_STMT;
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user