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

Function TestStmtQueryContextSuccess

stdlib/sql_test.go:906–931  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

904}
905
906func TestStmtQueryContextSuccess(t *testing.T) {
907 db := openDB(t)
908 defer closeDB(t, db)
909
910 skipCockroachDB(t, db, "Server issues incorrect ParameterDescription (https://github.com/cockroachdb/cockroach/issues/60907)")
911
912 stmt, err := db.Prepare("select * from generate_series(1,$1::int4) n")
913 require.NoError(t, err)
914 defer stmt.Close()
915
916 rows, err := stmt.QueryContext(context.Background(), 5)
917 require.NoError(t, err)
918
919 for rows.Next() {
920 var n int64
921 if err := rows.Scan(&n); err != nil {
922 t.Error(err)
923 }
924 }
925
926 if rows.Err() != nil {
927 t.Error(rows.Err())
928 }
929
930 ensureDBValid(t, db)
931}
932
933func TestRowsColumnTypes(t *testing.T) {
934 testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {

Callers

nothing calls this directly

Calls 11

openDBFunction · 0.85
closeDBFunction · 0.85
ensureDBValidFunction · 0.85
skipCockroachDBFunction · 0.70
PrepareMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
ScanMethod · 0.65
ErrMethod · 0.65
QueryContextMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected