Introduce internal protocol command enum
The enums exposed by the connector are not intended to be used by the users of the library. The fact that the protocol, and other, modules used it was in violation of how the library is intended to be used. Adding an internal mapping into MaxScale also removes some of the dependencies that the core has on the connector.
This commit is contained in:
@ -248,7 +248,7 @@ int CacheFilterSession::routeQuery(GWBUF* pPacket)
|
||||
|
||||
switch ((int)MYSQL_GET_COMMAND(pData))
|
||||
{
|
||||
case MYSQL_COM_INIT_DB:
|
||||
case MXS_COM_INIT_DB:
|
||||
{
|
||||
ss_dassert(!m_zUseDb);
|
||||
size_t len = MYSQL_GET_PAYLOAD_LEN(pData) - 1; // Remove the command byte.
|
||||
@ -272,21 +272,21 @@ int CacheFilterSession::routeQuery(GWBUF* pPacket)
|
||||
}
|
||||
break;
|
||||
|
||||
case MYSQL_COM_STMT_PREPARE:
|
||||
case MXS_COM_STMT_PREPARE:
|
||||
if (log_decisions())
|
||||
{
|
||||
MXS_NOTICE("MYSQL_COM_STMT_PREPARE, ignoring.");
|
||||
MXS_NOTICE("COM_STMT_PREPARE, ignoring.");
|
||||
}
|
||||
break;
|
||||
|
||||
case MYSQL_COM_STMT_EXECUTE:
|
||||
case MXS_COM_STMT_EXECUTE:
|
||||
if (log_decisions())
|
||||
{
|
||||
MXS_NOTICE("MYSQL_COM_STMT_EXECUTE, ignoring.");
|
||||
MXS_NOTICE("COM_STMT_EXECUTE, ignoring.");
|
||||
}
|
||||
break;
|
||||
|
||||
case MYSQL_COM_QUERY:
|
||||
case MXS_COM_QUERY:
|
||||
if (should_consult_cache(pPacket))
|
||||
{
|
||||
if (m_pCache->should_store(m_zDefaultDb, pPacket))
|
||||
|
||||
@ -1273,13 +1273,13 @@ static bool command_is_mandatory(const GWBUF *buffer)
|
||||
{
|
||||
switch (MYSQL_GET_COMMAND((uint8_t*)GWBUF_DATA(buffer)))
|
||||
{
|
||||
case MYSQL_COM_QUIT:
|
||||
case MYSQL_COM_PING:
|
||||
case MYSQL_COM_CHANGE_USER:
|
||||
case MYSQL_COM_SET_OPTION:
|
||||
case MYSQL_COM_FIELD_LIST:
|
||||
case MYSQL_COM_PROCESS_KILL:
|
||||
case MYSQL_COM_PROCESS_INFO:
|
||||
case MXS_COM_QUIT:
|
||||
case MXS_COM_PING:
|
||||
case MXS_COM_CHANGE_USER:
|
||||
case MXS_COM_SET_OPTION:
|
||||
case MXS_COM_FIELD_LIST:
|
||||
case MXS_COM_PROCESS_KILL:
|
||||
case MXS_COM_PROCESS_INFO:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@ -606,7 +606,7 @@ static bool extract_insert_target(GWBUF *buffer, char* target, int len)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
if (MYSQL_GET_COMMAND(GWBUF_DATA(buffer)) == MYSQL_COM_QUERY &&
|
||||
if (MYSQL_GET_COMMAND(GWBUF_DATA(buffer)) == MXS_COM_QUERY &&
|
||||
qc_get_operation(buffer) == QUERY_OP_INSERT &&
|
||||
only_implicit_values(buffer))
|
||||
{
|
||||
|
||||
@ -54,8 +54,8 @@ int MaskingFilterSession::routeQuery(GWBUF* pPacket)
|
||||
// TODO: Breaks if responses are not waited for, before the next request is sent.
|
||||
switch (request.command())
|
||||
{
|
||||
case MYSQL_COM_QUERY:
|
||||
case MYSQL_COM_STMT_EXECUTE:
|
||||
case MXS_COM_QUERY:
|
||||
case MXS_COM_STMT_EXECUTE:
|
||||
m_res.reset(request.command(), m_filter.rules());
|
||||
m_state = EXPECTING_RESPONSE;
|
||||
break;
|
||||
@ -273,7 +273,7 @@ void MaskingFilterSession::mask_values(ComPacket& response)
|
||||
{
|
||||
switch (m_res.command())
|
||||
{
|
||||
case MYSQL_COM_QUERY:
|
||||
case MXS_COM_QUERY:
|
||||
{
|
||||
ComQueryResponse::TextResultsetRow row(response, m_res.types());
|
||||
|
||||
@ -301,7 +301,7 @@ void MaskingFilterSession::mask_values(ComPacket& response)
|
||||
}
|
||||
break;
|
||||
|
||||
case MYSQL_COM_STMT_EXECUTE:
|
||||
case MXS_COM_STMT_EXECUTE:
|
||||
{
|
||||
ComQueryResponse::BinaryResultsetRow row(response, m_res.types());
|
||||
|
||||
|
||||
@ -354,8 +354,8 @@ static int routeQuery(MXS_FILTER *instance,
|
||||
|
||||
switch ((int)MYSQL_GET_COMMAND(data))
|
||||
{
|
||||
case MYSQL_COM_QUERY:
|
||||
case MYSQL_COM_STMT_EXECUTE:
|
||||
case MXS_COM_QUERY:
|
||||
case MXS_COM_STMT_EXECUTE:
|
||||
{
|
||||
/* Set input query only with MAXROWS_RETURN_ERR */
|
||||
if (csdata->instance->config.m_return == MAXROWS_RETURN_ERR &&
|
||||
|
||||
Reference in New Issue
Block a user