Moved helper function 'proxy_mysql_stmt_close' from 'gen_utils' to 'MySQL_Protocol' #3525

pull/3544/head
Javier Jaramago Fernández 5 years ago
parent 297bc8bae6
commit 4ea7b750fd

@ -64,6 +64,22 @@ class MySQL_Prepared_Stmt_info {
uint8_t mysql_decode_length(unsigned char *ptr, uint64_t *len);
/**
* @brief ProxySQL replacement function for 'mysql_stmt_close'. Closes a
* MYSQL_STMT avoiding any blocking commands that are sent by default
* 'mysql_stmt_close'.
*
* NOTE: This function is not safe, caller must check that the supplied
* argument is not NULL.
*
* @param mysql_stmt An already initialized 'MYSQL_STMT'. Caller must ensure
* that the supplied argument is not NULL.
*
* @return The result of calling 'mysql_stmt_close' function over the internally
* modified 'MYSQL_STMT'.
*/
my_bool proxy_mysql_stmt_close(MYSQL_STMT* mysql_stmt);
class MySQL_Protocol {
private:
MySQL_Connection_userinfo *userinfo;

@ -230,22 +230,6 @@ inline unsigned long long realtime_time() {
return (((unsigned long long) ts.tv_sec) * 1000000) + (ts.tv_nsec / 1000);
}
/**
* @brief ProxySQL replacement function for 'mysql_stmt_close'. Closes a
* MYSQL_STMT avoiding any blocking commands that are sent by default
* 'mysql_stmt_close'.
*
* NOTE: This function is not safe, caller must check that the supplied
* argument is not NULL.
*
* @param mysql_stmt An already initialized 'MYSQL_STMT'. Caller must ensure
* that the supplied argument is not NULL.
*
* @return The result of calling 'mysql_stmt_close' function over the internally
* modified 'MYSQL_STMT'.
*/
my_bool proxy_mysql_stmt_close(MYSQL_STMT* mysql_stmt);
#endif /* __GEN_FUNCTIONS */
bool Proxy_file_exists(const char *);

@ -4,6 +4,7 @@
#include "SpookyV2.h"
#include "MySQL_PreparedStatement.h"
#include "MySQL_Protocol.h"
//extern MySQL_STMT_Manager *GloMyStmt;
//static uint32_t add_prepared_statement_calls = 0;

@ -2925,3 +2925,15 @@ unsigned long long MySQL_ResultSet::current_size() {
}
return intsize;
}
my_bool proxy_mysql_stmt_close(MYSQL_STMT* stmt) {
// Clean internal structures for 'stmt->mysql->stmts'.
if (stmt->mysql) {
stmt->mysql->stmts =
list_delete(stmt->mysql->stmts, &stmt->list);
}
// Nullify 'mysql' field to avoid sending a blocking command to the server.
stmt->mysql = NULL;
// Perform the regular close operation.
return mysql_stmt_close(stmt);
}

@ -220,14 +220,3 @@ bool Proxy_file_regular(const char *path) {
return false;
}
my_bool proxy_mysql_stmt_close(MYSQL_STMT* stmt) {
// Clean internal structures for 'stmt->mysql->stmts'.
if (stmt->mysql) {
stmt->mysql->stmts =
list_delete(stmt->mysql->stmts, &stmt->list);
}
// Nullify 'mysql' field to avoid sending a blocking command to the server.
stmt->mysql = NULL;
// Perform the regular close operation.
return mysql_stmt_close(stmt);
}

Loading…
Cancel
Save