MCPcopy Create free account
hub / github.com/apecloud/myduckserver / Next

Method Next

pgserver/iter.go:51–74  ·  view source on GitHub ↗

Next retrieves the next row. It will return io.EOF if it's the last row.

(ctx *sql.Context)

Source from the content-addressed store, hash-verified

49
50// Next retrieves the next row. It will return io.EOF if it's the last row.
51func (iter *DriverRowIter) Next(ctx *sql.Context) (sql.Row, error) {
52 if err := iter.rows.Next(iter.buffer[:len(iter.columns)]); err != nil {
53 if err == io.EOF {
54 return nil, io.EOF
55 }
56 return nil, err
57 }
58
59 // Prune or fill the values to match the schema
60 width := len(iter.schema) // the desired width
61 if width == 0 {
62 width = len(iter.columns)
63 } else if len(iter.columns) < width {
64 for i := len(iter.columns); i < width; i++ {
65 iter.buffer[i] = nil
66 }
67 }
68
69 for i := 0; i < width; i++ {
70 iter.row[i] = iter.buffer[i]
71 }
72
73 return sql.NewRow(iter.row[:width]...), nil
74}
75
76// Close closes the underlying driver.Rows.
77func (iter *DriverRowIter) Close(ctx *sql.Context) error {

Callers

nothing calls this directly

Calls 1

NextMethod · 0.45

Tested by

no test coverage detected