MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / handleOKPacket

Method handleOKPacket

IceFireDB-SQLProxy/pkg/mysql/client/resp.go:39–69  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

37}
38
39func (c *Conn) handleOKPacket(data []byte) (*Result, error) {
40 var n int
41 pos := 1
42
43 // r := &Result{Resultset: &Resultset{}}
44 r := new(Result)
45
46 r.AffectedRows, _, n = LengthEncodedInt(data[pos:])
47 pos += n
48 r.InsertId, _, n = LengthEncodedInt(data[pos:])
49 pos += n
50
51 if c.capability&CLIENT_PROTOCOL_41 > 0 {
52 r.Status = binary.LittleEndian.Uint16(data[pos:])
53 c.status = r.Status
54 pos += 2
55
56 //todo:strict_mode, check warnings as error
57 r.Warnings = binary.LittleEndian.Uint16(data[pos:])
58 pos += 2
59 } else if c.capability&CLIENT_TRANSACTIONS > 0 {
60 r.Status = binary.LittleEndian.Uint16(data[pos:])
61 c.status = r.Status
62 pos += 2
63 }
64
65 // new ok package will check CLIENT_SESSION_TRACK too, but I don't support it now.
66
67 // skip info
68 return r, nil
69}
70
71func (c *Conn) handleErrorPacket(data []byte) error {
72 e := new(MyError)

Callers 5

readAuthResultMethod · 0.95
readOKMethod · 0.95
readResultMethod · 0.95
readResultStreamingMethod · 0.95
HandleOKPacketMethod · 0.95

Calls 1

LengthEncodedIntFunction · 0.50

Tested by

no test coverage detected