MCPcopy
hub / github.com/jackc/pgx / Read

Method Read

pgconn/pgconn.go:1733–1756  ·  view source on GitHub ↗

Read saves the query response to a Result.

()

Source from the content-addressed store, hash-verified

1731
1732// Read saves the query response to a Result.
1733func (rr *ResultReader) Read() *Result {
1734 br := &Result{}
1735
1736 for rr.NextRow() {
1737 if br.FieldDescriptions == nil {
1738 br.FieldDescriptions = make([]FieldDescription, len(rr.FieldDescriptions()))
1739 copy(br.FieldDescriptions, rr.FieldDescriptions())
1740 }
1741
1742 values := rr.Values()
1743 row := make([][]byte, len(values))
1744 for i := range row {
1745 if values[i] != nil {
1746 row[i] = make([]byte, len(values[i]))
1747 copy(row[i], values[i])
1748 }
1749 }
1750 br.Rows = append(br.Rows, row)
1751 }
1752
1753 br.CommandTag, br.Err = rr.Close()
1754
1755 return br
1756}
1757
1758// NextRow advances the ResultReader to the next row and returns true if a row is available.
1759func (rr *ResultReader) NextRow() bool {

Callers 6

newScramClientFunction · 0.45
ensureConnValidFunction · 0.45
CancelRequestMethod · 0.45
CopyFromMethod · 0.45
ReadAllMethod · 0.45
stressExecParamsSelectFunction · 0.45

Calls 4

NextRowMethod · 0.95
FieldDescriptionsMethod · 0.95
ValuesMethod · 0.95
CloseMethod · 0.95

Tested by 2

ensureConnValidFunction · 0.36
stressExecParamsSelectFunction · 0.36