Analyze binary prepared statements as well

Now that the query classifier can be given COM_STMT_PREPARE packets
in addition to COM_QUERY packets, binary prepared statements will
be subject to the same analyses as any other statement.
This commit is contained in:
Johan Wikman 2017-01-17 16:13:56 +02:00
parent ded9f668f1
commit 86c97a2109

View File

@ -2349,20 +2349,16 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
my_session->errmsg = NULL;
rval = dcb->func.write(dcb, err);
}
else if (qc_query_is_type(type, QUERY_TYPE_PREPARE_STMT) ||
modutil_is_SQL_prepare(queue))
{
GWBUF* err = gen_dummy_error(my_session, "This filter does not support "
"binary prepared statements.");
gwbuf_free(queue);
MXS_FREE(my_session->errmsg);
my_session->errmsg = NULL;
rval = dcb->func.write(dcb, err);
}
else
{
GWBUF* analyzed_queue = queue;
// QUERY_TYPE_PREPARE_STMT need not be handled separately as the
// information about statements in COM_STMT_PREPARE packets is
// accessed exactly like the information of COM_QUERY packets. However,
// with named prepared statements in COM_QUERY packets, we need to take
// out the preparable statement and base our decisions on that.
if (qc_query_is_type(type, QUERY_TYPE_PREPARE_NAMED_STMT))
{
analyzed_queue = qc_get_preparable_stmt(queue);