(data []byte)
| 37 | } |
| 38 | |
| 39 | func (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 | |
| 71 | func (c *Conn) handleErrorPacket(data []byte) error { |
| 72 | e := new(MyError) |
no test coverage detected