Combine and rename session statement functions
There was no real need to have two separate functions for getting the stored buffer and the target server. Combining them into one allows it to be handled in a nicer way.
This commit is contained in:
@ -395,18 +395,11 @@ bool session_store_stmt(SESSION *session, GWBUF *buf, const struct server *serve
|
|||||||
* The value returned by this call must be freed by the caller with gwbuf_free().
|
* The value returned by this call must be freed by the caller with gwbuf_free().
|
||||||
*
|
*
|
||||||
* @param session Session with a stored statement
|
* @param session Session with a stored statement
|
||||||
* @return Stored statement or NULL if no statement was stored
|
* @param buffer Pointer where the buffer is stored
|
||||||
|
* @param target Pointer where target server is stored
|
||||||
|
* @return True if a statement was stored
|
||||||
*/
|
*/
|
||||||
GWBUF* session_fetch_stmt(SESSION *session);
|
bool session_take_stmt(SESSION *session, GWBUF **buffer, const struct server **target);
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the stored target
|
|
||||||
*
|
|
||||||
* @param session Session whose target is fetched
|
|
||||||
* @return The server where the statement is executed or NULL if no statement is
|
|
||||||
* stored
|
|
||||||
*/
|
|
||||||
const struct server* session_fetch_stmt_target(const SESSION *session);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the stored statement
|
* Clear the stored statement
|
||||||
|
@ -964,16 +964,20 @@ bool session_store_stmt(SESSION *session, GWBUF *buf, const SERVER *server)
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
GWBUF *session_fetch_stmt(SESSION *session)
|
bool session_take_stmt(SESSION *session, GWBUF **buffer, const SERVER **target)
|
||||||
{
|
{
|
||||||
GWBUF *rval = session->stmt.buffer;
|
bool rval = false;
|
||||||
session->stmt.buffer = NULL;
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SERVER* session_fetch_stmt_target(const SESSION *session)
|
if (session->stmt.buffer && session->stmt.target)
|
||||||
{
|
{
|
||||||
return session->stmt.target;
|
*buffer = session->stmt.buffer;
|
||||||
|
*target = session->stmt.target;
|
||||||
|
session->stmt.buffer = NULL;
|
||||||
|
session->stmt.target = NULL;
|
||||||
|
rval = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_clear_stmt(SESSION *session)
|
void session_clear_stmt(SESSION *session)
|
||||||
|
Reference in New Issue
Block a user