diff --git a/backend/backend_conn.go b/backend/backend_conn.go index fd86e198..f1693cb5 100644 --- a/backend/backend_conn.go +++ b/backend/backend_conn.go @@ -649,14 +649,20 @@ func (c *Conn) handleOKPacket(data []byte) (*mysql.Result, error) { //todo:strict_mode, check warnings as error //Warnings := binary.LittleEndian.Uint16(data[pos:]) - //pos += 2 + pos += 2 } else if c.capability&mysql.CLIENT_TRANSACTIONS > 0 { r.Status = binary.LittleEndian.Uint16(data[pos:]) c.status = r.Status pos += 2 } - //info + //info https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html + if c.capability&mysql.CLIENT_SESSION_TRACK > 0 { + r.Info, _, n, _ = mysql.LengthEnodedString(data[pos:]) + } else { + r.Info = data[pos:] + } + return r, nil } diff --git a/mysql/const.go b/mysql/const.go index 61399716..05cfe740 100644 --- a/mysql/const.go +++ b/mysql/const.go @@ -101,6 +101,9 @@ const ( CLIENT_PLUGIN_AUTH CLIENT_CONNECT_ATTRS CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA + CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS + CLIENT_SESSION_TRACK + CLIENT_DEPRECATE_EOF ) //https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnType diff --git a/mysql/resultset.go b/mysql/resultset.go index 9b8fbe27..c364da6e 100644 --- a/mysql/resultset.go +++ b/mysql/resultset.go @@ -268,6 +268,8 @@ type Result struct { AffectedRows uint64 *Resultset + + Info []byte } type Resultset struct { diff --git a/proxy/server/conn.go b/proxy/server/conn.go index 44a70396..ef071b32 100644 --- a/proxy/server/conn.go +++ b/proxy/server/conn.go @@ -375,6 +375,7 @@ func (c *ClientConn) writeOK(r *mysql.Result) error { if c.capability&mysql.CLIENT_PROTOCOL_41 > 0 { data = append(data, byte(r.Status), byte(r.Status>>8)) data = append(data, 0, 0) + data = append(data, r.Info...) } return c.writePacket(data)