Remove MySQLBytesRequest. Add MySQLAuthSwitchRequest.

This commit is contained in:
Xie Han
2023-02-06 19:32:50 +08:00
parent 1a144f3bc0
commit 89ffe576ad
2 changed files with 58 additions and 10 deletions
+24 -10
View File
@@ -172,33 +172,47 @@ public:
MySQLAuthResponse& operator= (MySQLAuthResponse&& move) = default;
};
class MySQLBytesRequest : public MySQLRequest
class MySQLAuthSwitchRequest : public MySQLRequest
{
public:
void set_bytes(const void *bytes, size_t len)
void set_password(const std::string& password)
{
buf_.assign((const char *)bytes, len);
password_ = password;
}
std::string get_bytes() const
void set_auth_plugin_name(const std::string& name)
{
return buf_;
auth_plugin_name_ = name;
}
void set_challenge(const char *arr)
{
memcpy(challenge_, arr, 20);
}
private:
virtual int encode(struct iovec vectors[], int max);
virtual int decode_packet(const unsigned char *buf, size_t buflen)
{
buf_.assign((const char *)buf, buflen);
return 1;
}
private:
MySQLBytesRequest() { }
MySQLBytesRequest(MySQLBytesRequest&& move) = default;
//move operator
MySQLBytesRequest& operator= (MySQLBytesRequest&& move) = default;
std::string password_;
std::string auth_plugin_name_;
uint8_t challenge_[20];
public:
MySQLAuthSwitchRequest() { }
//move constructor
MySQLAuthSwitchRequest(MySQLAuthSwitchRequest&& move) = default;
//move operator
MySQLAuthSwitchRequest& operator= (MySQLAuthSwitchRequest&& move) = default;
};
using MySQLAuthSwitchResponse = MySQLResponse;
//////////
inline mysql_parser_t *MySQLMessage::get_parser() const