(binary bool)
| 217 | } |
| 218 | |
| 219 | func (c *Conn) readResult(binary bool) (*Result, error) { |
| 220 | firstPkgBuf, err := c.ReadPacketReuseMem(utils.ByteSliceGet(16)[:0]) |
| 221 | defer utils.ByteSlicePut(firstPkgBuf) |
| 222 | |
| 223 | if err != nil { |
| 224 | return nil, errors.Trace(err) |
| 225 | } |
| 226 | |
| 227 | if firstPkgBuf[0] == OK_HEADER { |
| 228 | return c.handleOKPacket(firstPkgBuf) |
| 229 | } else if firstPkgBuf[0] == ERR_HEADER { |
| 230 | return nil, c.handleErrorPacket(append([]byte{}, firstPkgBuf...)) |
| 231 | } else if firstPkgBuf[0] == LocalInFile_HEADER { |
| 232 | return nil, ErrMalformPacket |
| 233 | } |
| 234 | |
| 235 | return c.readResultset(firstPkgBuf, binary) |
| 236 | } |
| 237 | |
| 238 | func (c *Conn) readResultStreaming(binary bool, result *Result, perRowCb SelectPerRowCallback) error { |
| 239 | firstPkgBuf, err := c.ReadPacketReuseMem(utils.ByteSliceGet(16)[:0]) |
no test coverage detected