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

Method readResultRows

IceFireDB-SQLProxy/pkg/mysql/client/resp.go:365–410  ·  view source on GitHub ↗
(result *Result, isBinary bool)

Source from the content-addressed store, hash-verified

363}
364
365func (c *Conn) readResultRows(result *Result, isBinary bool) (err error) {
366 var data []byte
367
368 for {
369 rawPkgLen := len(result.RawPkg)
370 result.RawPkg, err = c.ReadPacketReuseMem(result.RawPkg)
371 if err != nil {
372 return
373 }
374 data = result.RawPkg[rawPkgLen:]
375
376 // EOF Packet
377 if c.isEOFPacket(data) {
378 if c.capability&CLIENT_PROTOCOL_41 > 0 {
379 result.Warnings = binary.LittleEndian.Uint16(data[1:])
380 // todo add strict_mode, warning will be treat as error
381 result.Status = binary.LittleEndian.Uint16(data[3:])
382 c.status = result.Status
383 }
384
385 break
386 }
387
388 if data[0] == ERR_HEADER {
389 return c.handleErrorPacket(data)
390 }
391
392 result.RowDatas = append(result.RowDatas, data)
393 }
394
395 if cap(result.Values) < len(result.RowDatas) {
396 result.Values = make([][]FieldValue, len(result.RowDatas))
397 } else {
398 result.Values = result.Values[:len(result.RowDatas)]
399 }
400
401 for i := range result.Values {
402 result.Values[i], err = result.RowDatas[i].Parse(result.Fields, isBinary, result.Values[i])
403
404 if err != nil {
405 return errors.Trace(err)
406 }
407 }
408
409 return nil
410}
411
412func (c *Conn) readResultRowsStreaming(result *Result, isBinary bool, perRowCb SelectPerRowCallback) (err error) {
413 var (

Callers 1

readResultsetMethod · 0.95

Calls 4

ReadPacketReuseMemMethod · 0.95
isEOFPacketMethod · 0.95
handleErrorPacketMethod · 0.95
ParseMethod · 0.45

Tested by

no test coverage detected