(result *Result, isBinary bool, perRowCb SelectPerRowCallback)
| 410 | } |
| 411 | |
| 412 | func (c *Conn) readResultRowsStreaming(result *Result, isBinary bool, perRowCb SelectPerRowCallback) (err error) { |
| 413 | var ( |
| 414 | data []byte |
| 415 | row []FieldValue |
| 416 | ) |
| 417 | |
| 418 | for { |
| 419 | data, err = c.ReadPacketReuseMem(data[:0]) |
| 420 | if err != nil { |
| 421 | return |
| 422 | } |
| 423 | |
| 424 | // EOF Packet |
| 425 | if c.isEOFPacket(data) { |
| 426 | if c.capability&CLIENT_PROTOCOL_41 > 0 { |
| 427 | result.Warnings = binary.LittleEndian.Uint16(data[1:]) |
| 428 | // todo add strict_mode, warning will be treat as error |
| 429 | result.Status = binary.LittleEndian.Uint16(data[3:]) |
| 430 | c.status = result.Status |
| 431 | } |
| 432 | |
| 433 | break |
| 434 | } |
| 435 | |
| 436 | if data[0] == ERR_HEADER { |
| 437 | return c.handleErrorPacket(data) |
| 438 | } |
| 439 | |
| 440 | // Parse this row |
| 441 | row, err = RowData(data).Parse(result.Fields, isBinary, row) |
| 442 | if err != nil { |
| 443 | return errors.Trace(err) |
| 444 | } |
| 445 | |
| 446 | // Send the row to "userland" code |
| 447 | err = perRowCb(row) |
| 448 | if err != nil { |
| 449 | return errors.Trace(err) |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | return nil |
| 454 | } |
no test coverage detected