Clean up bits and pieces, removed some unnecessary checks.
This commit is contained in:
@ -1210,6 +1210,8 @@ bool is_drop_table_query(GWBUF* querybuf)
|
|||||||
lex->sql_command == SQLCOM_DROP_TABLE);
|
lex->sql_command == SQLCOM_DROP_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline void add_str(char** buf, int* buflen, int* bufsize, char* str)
|
inline void add_str(char** buf, int* buflen, int* bufsize, char* str)
|
||||||
{
|
{
|
||||||
int isize = strlen(str) + 1;
|
int isize = strlen(str) + 1;
|
||||||
@ -1542,7 +1544,7 @@ static void parsing_info_set_plain_str(
|
|||||||
* @return string representing the query type value
|
* @return string representing the query type value
|
||||||
*/
|
*/
|
||||||
char* skygw_get_qtype_str(
|
char* skygw_get_qtype_str(
|
||||||
skygw_query_type_t qtype)
|
skygw_query_type_t qtype)
|
||||||
{
|
{
|
||||||
int t1 = (int)qtype;
|
int t1 = (int)qtype;
|
||||||
int t2 = 1;
|
int t2 = 1;
|
||||||
@ -1554,29 +1556,31 @@ char* skygw_get_qtype_str(
|
|||||||
* t1 is completely cleared.
|
* t1 is completely cleared.
|
||||||
*/
|
*/
|
||||||
while (t1 != 0)
|
while (t1 != 0)
|
||||||
{
|
{
|
||||||
if (t1&t2)
|
if (t1&t2)
|
||||||
{
|
{
|
||||||
t = (skygw_query_type_t)t2;
|
t = (skygw_query_type_t)t2;
|
||||||
|
|
||||||
if (qtype_str == NULL)
|
if (qtype_str == NULL)
|
||||||
{
|
{
|
||||||
qtype_str = strdup(STRQTYPE(t));
|
qtype_str = strdup(STRQTYPE(t));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t len = strlen(STRQTYPE(t));
|
size_t len = strlen(STRQTYPE(t));
|
||||||
/** reallocate space for delimiter, new string and termination */
|
/** reallocate space for delimiter, new string and termination */
|
||||||
qtype_str = (char *)realloc(qtype_str, strlen(qtype_str)+1+len+1);
|
qtype_str = (char *)realloc(qtype_str, strlen(qtype_str)+1+len+1);
|
||||||
snprintf(qtype_str+strlen(qtype_str), 1+len+1, "|%s", STRQTYPE(t));
|
snprintf(qtype_str+strlen(qtype_str), 1+len+1, "|%s", STRQTYPE(t));
|
||||||
}
|
}
|
||||||
/** Remove found value from t1 */
|
/** Remove found value from t1 */
|
||||||
t1 &= ~t2;
|
t1 &= ~t2;
|
||||||
}
|
|
||||||
t2 <<= 1;
|
|
||||||
}
|
}
|
||||||
|
t2 <<= 1;
|
||||||
|
}
|
||||||
return qtype_str;
|
return qtype_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
skygw_query_op_t query_classifier_get_operation(GWBUF* querybuf)
|
skygw_query_op_t query_classifier_get_operation(GWBUF* querybuf)
|
||||||
{
|
{
|
||||||
LEX* lex = get_lex(querybuf);
|
LEX* lex = get_lex(querybuf);
|
||||||
|
@ -1222,7 +1222,7 @@ dcb_close(DCB *dcb)
|
|||||||
* dcb_close may be called for freshly created dcb, in which case
|
* dcb_close may be called for freshly created dcb, in which case
|
||||||
* it only needs to be freed.
|
* it only needs to be freed.
|
||||||
*/
|
*/
|
||||||
if (dcb->state == DCB_STATE_ALLOC)
|
if (dcb->state == DCB_STATE_ALLOC)
|
||||||
{
|
{
|
||||||
dcb_set_state(dcb, DCB_STATE_DISCONNECTED, NULL);
|
dcb_set_state(dcb, DCB_STATE_DISCONNECTED, NULL);
|
||||||
dcb_final_free(dcb);
|
dcb_final_free(dcb);
|
||||||
|
@ -1118,7 +1118,7 @@ gw_backend_hangup(DCB *dcb)
|
|||||||
|
|
||||||
gwbuf_free(errbuf);
|
gwbuf_free(errbuf);
|
||||||
/** There are no required backends available, close session. */
|
/** There are no required backends available, close session. */
|
||||||
if (!succp)
|
if (!succp)
|
||||||
{
|
{
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
@ -836,7 +836,7 @@ static void* newSession(
|
|||||||
free(backend_ref);
|
free(backend_ref);
|
||||||
client_rses = NULL;
|
client_rses = NULL;
|
||||||
goto return_rses;
|
goto return_rses;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Initialize backend references with BACKEND ptr.
|
* Initialize backend references with BACKEND ptr.
|
||||||
* Initialize session command cursors for each backend reference.
|
* Initialize session command cursors for each backend reference.
|
||||||
@ -2706,7 +2706,7 @@ static void clientReply (
|
|||||||
goto lock_failed;
|
goto lock_failed;
|
||||||
}
|
}
|
||||||
/** There is one pending session command to be executed. */
|
/** There is one pending session command to be executed. */
|
||||||
if (sescmd_cursor_is_active(scur))
|
if (sescmd_cursor_is_active(scur))
|
||||||
{
|
{
|
||||||
bool succp;
|
bool succp;
|
||||||
|
|
||||||
@ -2962,7 +2962,7 @@ static bool select_connect_backend_servers(
|
|||||||
{
|
{
|
||||||
succp = false;
|
succp = false;
|
||||||
goto return_succp;
|
goto return_succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (router->bitvalue != 0) /*< 'synced' is the only bitvalue in rwsplit */
|
if (router->bitvalue != 0) /*< 'synced' is the only bitvalue in rwsplit */
|
||||||
{
|
{
|
||||||
@ -3611,7 +3611,7 @@ static GWBUF* sescmd_cursor_process_replies(
|
|||||||
bref_clear_state(bref, BREF_WAITING_RESULT);
|
bref_clear_state(bref, BREF_WAITING_RESULT);
|
||||||
}
|
}
|
||||||
/** Response is in the buffer and it will be sent to client. */
|
/** Response is in the buffer and it will be sent to client. */
|
||||||
else if (replybuf != NULL)
|
else
|
||||||
{
|
{
|
||||||
/** Mark the rest session commands as replied */
|
/** Mark the rest session commands as replied */
|
||||||
scmd->my_sescmd_is_replied = true;
|
scmd->my_sescmd_is_replied = true;
|
||||||
@ -4544,7 +4544,7 @@ static bool handle_error_new_connection(
|
|||||||
succp = true;
|
succp = true;
|
||||||
goto return_succp;
|
goto return_succp;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Remove callback because this DCB won't be used
|
* Remove callback because this DCB won't be used
|
||||||
* unless it is reconnected later, and then the callback
|
* unless it is reconnected later, and then the callback
|
||||||
* is set again.
|
* is set again.
|
||||||
|
Reference in New Issue
Block a user