Skip to content

Commit

Permalink
Merge pull request #1354 from Barenboim/master
Browse files Browse the repository at this point in the history
MySQL client add CLIENT_SESSION_TRACK.
  • Loading branch information
Barenboim authored Aug 15, 2023
2 parents 01ae6ad + a39bd63 commit 0caa115
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/protocol/MySQLMessage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/protocol/mysql_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0caa115

Please sign in to comment.