(r *Result)
| 7 | ) |
| 8 | |
| 9 | func (c *Conn) writeOK(r *Result) error { |
| 10 | if r == nil { |
| 11 | r = &Result{} |
| 12 | } |
| 13 | |
| 14 | r.Status |= c.status |
| 15 | |
| 16 | data := make([]byte, 4, 32) |
| 17 | |
| 18 | data = append(data, OK_HEADER) |
| 19 | |
| 20 | data = append(data, PutLengthEncodedInt(r.AffectedRows)...) |
| 21 | data = append(data, PutLengthEncodedInt(r.InsertId)...) |
| 22 | |
| 23 | if c.capability&CLIENT_PROTOCOL_41 > 0 { |
| 24 | data = append(data, byte(r.Status), byte(r.Status>>8)) |
| 25 | data = append(data, byte(r.Warnings), byte(r.Warnings>>8)) |
| 26 | } |
| 27 | |
| 28 | return c.WritePacket(data) |
| 29 | } |
| 30 | |
| 31 | func (c *Conn) WriteError(e error) error { |
| 32 | return c.writeError(e) |
no test coverage detected