Improvements and fixes to strchr_esc_mysql
The C style comments were not ignored and the -- style comments did not check for the trailing whitespace and made return values char*. The creation of a stored procedure would prevent sessions from using any of the slave servers because readwritesplit would interpret the creation statement as a multi-statement query. Parts of modutil and readwritesplit now compare pointers to pointers instead of converting pointers to integers.
This commit is contained in:
@ -5366,11 +5366,19 @@ static void check_for_multi_stmt(ROUTER_CLIENT_SES* rses, GWBUF *buf,
|
||||
|
||||
if ((ptr = strnchr_esc_mysql(data, ';', buflen)))
|
||||
{
|
||||
ptr++;
|
||||
if (ptr - data < buflen && !is_mysql_comment_start(ptr, ptr - data))
|
||||
/** Skip stored procedures etc. */
|
||||
while (ptr && is_mysql_sp_end(ptr, ptr - data))
|
||||
{
|
||||
rses->forced_node = rses->rses_master_ref;
|
||||
MXS_INFO("Multi-statement query, routing all future queries to master.");
|
||||
ptr = strnchr_esc_mysql(ptr + 1, ';', ptr - data);
|
||||
}
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
if (ptr < data + buflen && !is_mysql_comment_start(ptr, ptr - data))
|
||||
{
|
||||
rses->forced_node = rses->rses_master_ref;
|
||||
MXS_INFO("Multi-statement query, routing all future queries to master.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user