MCPcopy Create free account
hub / github.com/PostHog/duckgres / fetchCursorRows

Function fetchCursorRows

tests/integration/cursor_test.go:67–86  ·  view source on GitHub ↗

fetchCursorRows runs a FETCH/MOVE statement on the transaction's connection (lib/pq sends it via the simple query protocol) and collects any rows it returned. Statements that return no result set yield an empty slice.

(t *testing.T, tx *sql.Tx, stmt string)

Source from the content-addressed store, hash-verified

65// (lib/pq sends it via the simple query protocol) and collects any rows it
66// returned. Statements that return no result set yield an empty slice.
67func fetchCursorRows(t *testing.T, tx *sql.Tx, stmt string) []cursorRow {
68 t.Helper()
69 rows, err := tx.Query(stmt)
70 if err != nil {
71 t.Fatalf("%s: %v", stmt, err)
72 }
73 defer func() { _ = rows.Close() }()
74 var out []cursorRow
75 for rows.Next() {
76 var r cursorRow
77 if err := rows.Scan(&r.id, &r.name); err != nil {
78 t.Fatalf("%s: scan: %v", stmt, err)
79 }
80 out = append(out, r)
81 }
82 if err := rows.Err(); err != nil {
83 t.Fatalf("%s: rows: %v", stmt, err)
84 }
85 return out
86}
87
88func mustExecTx(t *testing.T, tx *sql.Tx, stmt string) {
89 t.Helper()

Callers 4

cursorLifecycleFlowFunction · 0.85
cursorMoveFlowFunction · 0.85
cursorBackwardFlowFunction · 0.85
TestCursorSimpleQueryFunction · 0.85

Calls 5

QueryMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
ScanMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected