resultForEmptyIter ensures that an expected empty iterator returns no rows.
(ctx *sql.Context, iter sql.RowIter)
| 579 | |
| 580 | // resultForEmptyIter ensures that an expected empty iterator returns no rows. |
| 581 | func resultForEmptyIter(ctx *sql.Context, iter sql.RowIter) (*Result, error) { |
| 582 | defer trace.StartRegion(ctx, "DoltgresHandler.resultForEmptyIter").End() |
| 583 | if _, err := iter.Next(ctx); err != io.EOF { |
| 584 | return nil, errors.Errorf("result schema iterator returned more than zero rows") |
| 585 | } |
| 586 | if err := iter.Close(ctx); err != nil { |
| 587 | return nil, err |
| 588 | } |
| 589 | return &Result{Fields: nil}, nil |
| 590 | } |
| 591 | |
| 592 | // resultForMax1RowIter ensures that an empty iterator returns at most one row |
| 593 | func resultForMax1RowIter(ctx *sql.Context, schema sql.Schema, iter sql.RowIter, resultFields []pgproto3.FieldDescription, formatCodes []int16) (*Result, error) { |