Merge pull request #1354 from Barenboim/master

MySQL client add CLIENT_SESSION_TRACK.
This commit is contained in:
xiehan
2023-08-15 23:45:22 +08:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@@ -190,6 +190,7 @@ std::string MySQLRequest::get_query() const
#define MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS 0x00040000
#define MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH 0x00080000
#define MYSQL_CAPFLAG_CLIENT_LOCAL_FILES 0x00000080
#define MYSQL_CAPFLAG_CLIENT_SESSION_TRACK (1 << 23)
int MySQLHandshakeResponse::encode(struct iovec vectors[], int max)
{
@@ -336,7 +337,8 @@ int MySQLSSLRequest::encode(struct iovec vectors[], int max)
MYSQL_CAPFLAG_CLIENT_LOCAL_FILES |
MYSQL_CAPFLAG_CLIENT_MULTI_STATEMENTS |
MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS |
MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH);
MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH |
MYSQL_CAPFLAG_CLIENT_SESSION_TRACK);
pos += 4;
int4store(pos, 0);
pos += 4;
@@ -374,7 +376,8 @@ int MySQLAuthRequest::encode(struct iovec vectors[], int max)
MYSQL_CAPFLAG_CLIENT_LOCAL_FILES |
MYSQL_CAPFLAG_CLIENT_MULTI_STATEMENTS |
MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS |
MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH);
MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH |
MYSQL_CAPFLAG_CLIENT_SESSION_TRACK);
pos += 4;
int4store(pos, 0);
pos += 4;

View File

@@ -204,11 +204,17 @@ static int parse_ok_packet(const void *buf, size_t len, mysql_parser_t *parser)
if (server_status & MYSQL_SERVER_SESSION_STATE_CHANGED)
{
const unsigned char *tmp_str;
unsigned long long tmp_len;
if (decode_string(&str, &info_len, &p, buf_end) == 0)
return -2;
if (decode_string(&tmp_str, &tmp_len, &p, buf_end) == 0)
return -2;
} else {
info_len = 0;
str = p;
info_len = 0;
}
result_set = (struct __mysql_result_set *)malloc(sizeof(struct __mysql_result_set));