Check before clearing statements stored in the session
If the session has no stored statements, there's no need to clear them.
This commit is contained in:
parent
b00964dc54
commit
9d6c2010b3
@ -407,6 +407,18 @@ bool session_store_stmt(MXS_SESSION *session, GWBUF *buf, const struct server *s
|
||||
*/
|
||||
bool session_take_stmt(MXS_SESSION *session, GWBUF **buffer, const struct server **target);
|
||||
|
||||
/**
|
||||
* @brief Check if the session has a stored statement
|
||||
*
|
||||
* @param session Session to check
|
||||
*
|
||||
* @return True if the session has a stored statement
|
||||
*/
|
||||
static inline bool session_have_stmt(MXS_SESSION *session)
|
||||
{
|
||||
return session->stmt.buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stored statement
|
||||
*
|
||||
|
@ -1196,8 +1196,11 @@ static void clientReply(MXS_ROUTER *instance,
|
||||
return;
|
||||
}
|
||||
|
||||
/** Statement was successfully executed, free the stored statement */
|
||||
session_clear_stmt(backend_dcb->session);
|
||||
if (session_have_stmt(backend_dcb->session))
|
||||
{
|
||||
/** Statement was successfully executed, free the stored statement */
|
||||
session_clear_stmt(backend_dcb->session);
|
||||
}
|
||||
|
||||
if (reply_is_complete(backend, writebuf))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user