support deprecated eof and fix eof count
This commit is contained in:
@ -353,7 +353,7 @@ typedef struct
|
|||||||
int ignore_replies; /*< How many replies should be discarded */
|
int ignore_replies; /*< How many replies should be discarded */
|
||||||
GWBUF* stored_query; /*< Temporarily stored queries */
|
GWBUF* stored_query; /*< Temporarily stored queries */
|
||||||
bool collect_result; /*< Collect the next result set as one buffer */
|
bool collect_result; /*< Collect the next result set as one buffer */
|
||||||
int num_eof_packets; /*< Signal number to indicate is current packet is ok packet*/
|
uint32_t num_eof_packets; /*< Signal number to indicate is current packet is ok packet*/
|
||||||
#if defined(SS_DEBUG)
|
#if defined(SS_DEBUG)
|
||||||
skygw_chk_t protocol_chk_tail;
|
skygw_chk_t protocol_chk_tail;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1231,6 +1231,8 @@ create_capabilities(MySQLProtocol *conn, bool with_ssl, bool db_specified, bool
|
|||||||
}
|
}
|
||||||
/** add session track */
|
/** add session track */
|
||||||
final_capabilities |= (uint32_t)GW_MYSQL_CAPABILITIES_SESSION_TRACK;
|
final_capabilities |= (uint32_t)GW_MYSQL_CAPABILITIES_SESSION_TRACK;
|
||||||
|
/** support deprecate eof */
|
||||||
|
final_capabilities |= (uint32_t)GW_MYSQL_CAPABILITIES_DEPRECATE_EOF;
|
||||||
|
|
||||||
/* Compression is not currently supported */
|
/* Compression is not currently supported */
|
||||||
ss_dassert(!compress);
|
ss_dassert(!compress);
|
||||||
@ -1855,30 +1857,30 @@ void mxs_mysql_get_session_track_info(GWBUF *buff, MySQLProtocol *proto)
|
|||||||
{
|
{
|
||||||
while (gwbuf_copy_data(buff, offset, MYSQL_HEADER_LEN+1, header_and_command) == (MYSQL_HEADER_LEN+1))
|
while (gwbuf_copy_data(buff, offset, MYSQL_HEADER_LEN+1, header_and_command) == (MYSQL_HEADER_LEN+1))
|
||||||
{
|
{
|
||||||
size_t packet_len = gw_mysql_get_byte3(header_and_command) + MYSQL_HEADER_LEN;
|
size_t packet_len = gw_mysql_get_byte3(header_and_command);
|
||||||
uint8_t cmd = header_and_command[MYSQL_COM_OFFSET];
|
uint8_t cmd = header_and_command[MYSQL_COM_OFFSET];
|
||||||
if (packet_len > MYSQL_OK_PACKET_MIN_LEN && cmd == MYSQL_REPLY_OK && proto->num_eof_packets == 0)
|
|
||||||
|
if ((proto->current_command == MXS_COM_QUERY ||
|
||||||
|
proto->current_command == MXS_COM_STMT_FETCH ||
|
||||||
|
proto->current_command == MXS_COM_STMT_EXECUTE) &&
|
||||||
|
cmd == MYSQL_REPLY_EOF)
|
||||||
|
{
|
||||||
|
proto->num_eof_packets++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet_len > MYSQL_OK_PACKET_MIN_LEN &&
|
||||||
|
(proto->num_eof_packets % 2) == 0)
|
||||||
|
{
|
||||||
|
/* ok packet or deprecated eof */
|
||||||
|
if (cmd == MYSQL_REPLY_OK ||
|
||||||
|
(cmd == MYSQL_REPLY_EOF &&
|
||||||
|
proto->server_capabilities & GW_MYSQL_CAPABILITIES_DEPRECATE_EOF))
|
||||||
{
|
{
|
||||||
buff->gwbuf_type |= GWBUF_TYPE_REPLY_OK;
|
buff->gwbuf_type |= GWBUF_TYPE_REPLY_OK;
|
||||||
mxs_mysql_parse_ok_packet(buff, offset, packet_len);
|
mxs_mysql_parse_ok_packet(buff, offset, packet_len);
|
||||||
}
|
}
|
||||||
offset += packet_len;
|
|
||||||
|
|
||||||
/* first packet of result set */
|
|
||||||
if ((proto->current_command == MXS_COM_QUERY ||
|
|
||||||
proto->current_command == MXS_COM_STMT_FETCH ||
|
|
||||||
proto->current_command == MXS_COM_STMT_EXECUTE) &&
|
|
||||||
proto->num_eof_packets == 0 &&
|
|
||||||
cmd > MYSQL_REPLY_OK &&
|
|
||||||
cmd < MYSQL_REPLY_LOCAL_INFILE)
|
|
||||||
{
|
|
||||||
proto->num_eof_packets = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd == MYSQL_REPLY_EOF && proto->num_eof_packets > 0)
|
|
||||||
{
|
|
||||||
proto->num_eof_packets--;
|
|
||||||
}
|
}
|
||||||
|
offset += (packet_len + + MYSQL_HEADER_LEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user