MCPcopy Create free account
hub / github.com/dolthub/doltgresql / resultForEmptyIter

Function resultForEmptyIter

server/doltgres_handler.go:581–590  ·  view source on GitHub ↗

resultForEmptyIter ensures that an expected empty iterator returns no rows.

(ctx *sql.Context, iter sql.RowIter)

Source from the content-addressed store, hash-verified

579
580// resultForEmptyIter ensures that an expected empty iterator returns no rows.
581func 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
593func resultForMax1RowIter(ctx *sql.Context, schema sql.Schema, iter sql.RowIter, resultFields []pgproto3.FieldDescription, formatCodes []int16) (*Result, error) {

Callers 1

doQueryMethod · 0.85

Calls 3

ErrorfMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.45

Tested by

no test coverage detected